if (1 -eq 2) {echo "True"} else {echo "False"}You can use any of the comparison operators in your «If» command :
| -eq | Equal | 
| -ne | Not equal | 
| -gt | Greater than | 
| -ge | Greater than or equal to | 
| -lt | Less than | 
| -le | Less than or equal to | 
| -like | Wild card comparison : “powershell” –like “pow*” | 
| -notlike | Negative wild card comparison | 
| -match | Regular expression comparison | 
| -notmatch | Negative Regular expression comparison | 
| -contains | “powershell” –contains “Shell” | 
| -notcontains | “powershell” –notcontains “Shell” | 
All those comparison operators are case-insensitive.
You ca also use any of the logical operators :
-and
-or
-xor
-not
!
No comments:
Post a Comment