5
Operators
In programming, an operator is a keyword that is used to manipulate an item of data. An operator might be used to compare values, add or subtract, perform replacements, split or join values, and so on. An operator is a fundamental part of any programming language, and PowerShell is no exception.
PowerShell has a wide variety of operators; each is explored within this chapter.
Many of the operators in PowerShell are binary, requiring two arguments (operands), such as -eq, -like, and so on.
Unary operators require a single argument (on the right-hand side), such as the -not and -bnot operators.
Ternary operators, which are new in PowerShell 7, require three arguments.
A small number of operators can be used as both unary and binary, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access