Difference between revisions of "Power Shell"

Jump to navigation Jump to search
154 bytes added ,  09:06, 18 March 2011
→‎Strings: Added .Contains
(→‎Datetime: Re-ordered sections)
(→‎Strings: Added .Contains)
Line 179: Line 179:


<br>'''Match (basic)'''<br>
<br>'''Match (basic)'''<br>
To do a basic comparison...
To do a basic search/match...
<source lang="powershell">
if ($res.Contains("Success")) {
    # String did contain
} else {
    # Didn't
}
</source>
...which is much preferable to...
<source lang="powershell">
<source lang="powershell">
if ($res.CompareTo("Success")) {
if ($res.CompareTo("Success")) {

Navigation menu