Difference between revisions of "Power Shell"

Jump to navigation Jump to search
375 bytes added ,  12:35, 11 February 2010
m
→‎Strings: Added "Replace"
m (→‎Help Commands: Reformat)
m (→‎Strings: Added "Replace")
Line 94: Line 94:
</source>
</source>


'''Interpolation'''
<br>'''Interpolation''' <br>
 
Interpolation allows variables to be embedded into a string and to be resolved into their actual values.  This works between double quotes, but not between single quotes...
Interpolation allows variables to be embedded into a string and to be resolved into their actual values.  This works between double quotes, but not between single quotes...
<source lang="powershell">
<source lang="powershell">
Line 104: Line 103:
Variable has been $sub
Variable has been $sub
</source>
</source>
<br>'''Replace''' <br>
Basic find and replace can be done with the Replace CmdLet, eg to replace "\" with "\\" in the $query variable...
<source lang="powershell"> $query = $query.Replace("\", "\\") </source>
For proper regular expressions support, use the following syntax
<source lang="powershell"> $query = [regex]::Replace($query, "search", "replace") </source>


== Credentials ==
== Credentials ==

Navigation menu