Export (0) Print
Expand All
Expand Minimize

Converting VBScript's Not Operator


Windows PowerShell


Definition: Performs logical negation on an expression.

Not Operator

Before you go any further remember, the Scripting Guys don’t make up these operators; we just report back what they do. The NOT operator is designed to test whether an expression is false. If an expression is false then the NOT operator reports back True. If an expression is true, then the NOT operator reports back False.

Like we said, we don’t make these things up, although, now that we think about it, this one does sound like something the Scripting Guys would come up with, doesn’t it?

For example, this command uses the NOT operator to evaluate the following expression 10 * 7.7. = 77:



$a = -not (10 * 7.7 -eq 77)

Because this expression is true, if you run this command and echo back the value of $a you’ll get the following:



False


Return to the VBScript to Windows PowerShell home page

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft