Not

The -not (or !) operator may be used to negate the expression which follows.

For example, each of the following returns true:

-not $false 
-not (Test-Path X:) 
-not ($true -and $false) 
!($true -and $false) 
Double negatives:
The -not operator has an important place, but it is worth rethinking an expression if it injects a double negative. For example, the following expression will return true:
-not (1 -ne 1)
The preceding expression is better written using the -eq operator:
1 -eq 1
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.93.12