Like any other programming or scripting languages, Operators are the building blocks of the Windows PowerShell. An operator is a character that can be used in the commands or expressions. It tells the compiler or interpreter to perform the specific operations and produce the final result.
PowerShell supports the following different types of operators:
The arithmetic operators are used in a PowerShell to perform the calculation of the numeric values. By using these operators, we can add (+), subtract (-), multiply (*), or divide (/) the values. These operators also include the modulus (%) operator to calculate the remainder of the division operation.
In PowerShell, the addition and multiplication operator may also be used with the strings and arrays.
The assignment operators are used in a PowerShell to assign, change, or append the values in a variable. The most commonly used assignment operator (=), which is used to assign a given value to the variable. There are some other assignment operators (+=, -=, *=, /=, %=), which modify the value of a variable before assigning it.
The comparison operators are used in PowerShell to compare the values. For example, we can compare the string of two values to check that they are equal or not.
The logical operators are used in PowerShell to connect expressions or statements together to form a single expression. Those expressions which contain the logical operators usually result in the Boolean values True or False.
The redirection operators are used in PowerShell to redirect the output of one command as an input to another command. This operator describes how to redirect the output from the PowerShell to the text files.
Split and Join Operators
The Split and Join operators are used in PowerShell to divide and combine the substrings. The Join operator is used to concatenate the multiple strings into a single string. The split operator is used to split a string into substrings.