Appearance
逻辑
PowerShell 逻辑常量为 $true 和 $false 。
逻辑运算符有:-and 、-or 和 -not 。
比较运算符有
- -eq 等于
- -ne 不等于
- -gt 大于
- -lt 小于
- -ge 大于等于
- -le 小于等于
- -is 类型相同
- -isnot 类型不同
- -in 值属于集合
检查数据类型
123 -is [int]
1.5 -is [double]
'123' -is [string]
$true -is [bool]True
True
True
True判断值是否属于集合。
1 -in 1..10
-1 -in 1..10True
False