February 2019
Intermediate to advanced
626 pages
15h 51m
English
The -eq (equal to) and -ne (not equal to) operators perform exact (and, by default, case insensitive) comparisons. In the example below, the following returns true:
1 -eq 1 'string' -eq 'string' [char]'a' -eq 'A' $true -eq 1 $false -eq 0
Similarly, -ne (not equal) will return true for each of the following:
20 -ne 100 'this' -ne 'that' $false -ne 'false'
The last example compares $false, the Boolean, with a string containing the word false. PowerShell will attempt to convert the word, but as the word is not an empty string, the result will be true.
Read now
Unlock full access