And / OR comparison operators
The –and
and –or
comparison operators are used to evaluate multiple expressions present within a single line of code. These are used to see whether two or more expressions evaluate to be True
. The –and
comparison operator mandates that both evaluations must evaluate to be True
to proceed in the statement. This means that expression1
and expression2
must be True
to continue. The –or
comparison operator only requires one of the two expressions to be True
. This means that expression1
or expression2
can be True
to continue. As you are learning PowerShell, you will want to use caution while using the -and
and -or
comparison operators as they can quickly complicate the logic of your scripts.
A script that shows how to use ...
Get Mastering Windows PowerShell Scripting now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.