Powershell-comparison-operators-examples

提供:Dev Guides
移動先:案内検索

Powershell-比較演算子の例

次のスクリプトは、比較演算子を示しています。

> $a = 10

> $b = 20

> $a -eq $b
 False

> $a -ne $b
 True

> $b -gt $a
 True

> $b -ge $a
 True

> $b -lt $a
 False

> $b -le $a
 False

> $a = "mahesh"

> $b = "suresh"

> $a -like '*ahe*'
 True

> $a -notLike '*ahe*'
 True

> $b -match '[h$]'
 True

> $b -notMatch '[h$]'
 False

> $a = 'abc'

> $b = 'abc'

> $b -contains $a
 True

> $b -notContains $a
 False