Operator and its Description
Operator | Description |
---|---|
-eq | Equal to |
-lt | Less than |
-gt | Greater than |
-ge | Greater than or Eqaul to |
-le | Less than or equal to |
-ne | Not equal to |
Example
$a = "The quick brown fox jumped over the lazy dog"
$z = "fox"
If ($a -contains $z)
{
$b = "The line is " + $True
}
Else
{
$b = "This is lie and " + $false
}
$b
Example
$Users = "John Doe","Dave Davis","Dick Jones"
$Users -contains "John Doe"
The result is True
Examples for comparison operators are -eq, -ne, -ge, -notlike, -gt, -lt, -le, -like, -match, -notmatch, -contains, -notcontains, -is, -isnot, -in, -notin, and so on.