PowerShell: Boolean Operators

By Xah Lee. Date: .

Operator names are case-insensitive.

Logical Operators

a -and b
True when both sides are true.
a -or b
True when at least one side is true.
a -xor b
“exclusive or”. True when the two sides are different.
-not a
negation.
! a
Same as -not

PowerShell Operators

PowerShell

Practical How-To

list files

list dirs

on dir

on file

Windows config

zip tar

misc


PowerShell in Depth

Programing PowerShell

Value Types

String

Variable

Boolean

Conditional

Data Structure

Loop and Iteration

Input/Output

Function

Profile and Script

Script Examples