Difference between revisions of "Power Shell"

Jump to navigation Jump to search
(→‎Network: Added WoL Script)
(→‎Strings: Added "Match (basic))
Line 117: Line 117:
{
{
         # StringToFind found in $text
         # StringToFind found in $text
}
</source>
<br>'''Match (basic)'''<br>
To do a basic comparison...
<source lang="powershell">
if ($res.CompareTo("Success")) {
    # Didn't match (CompareTo returns 1 if comparison fails !)
} else {
    # Did match
}
}
</source>
</source>
Line 140: Line 150:
<br>'''Strip Whitespace'''<br>
<br>'''Strip Whitespace'''<br>
<source lang="powershell"> $string = $string.TrimEnd() </source>
<source lang="powershell"> $string = $string.TrimEnd() </source>


=== Arrays ===
=== Arrays ===