Javatpoint Logo
Javatpoint Logo

PowerShell Operators

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:

PowerShell Operators
  1. Arithmetic Operators
  2. Assignment Operators
  3. Comparison Operators
  4. Logical Operators
  5. Redirection Operators
  6. Split and Join Operators

Arithmetic 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.

Assignment Operators

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.

Comparison Operators

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.

Logical Operators

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.

Redirection Operators

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.






Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA