麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 開發(fā) > PowerShell > 正文

Windows Powershell條件表達式之條件操作符

2020-10-29 21:02:19
字體:
供稿:網(wǎng)友

Powershell 中的比較運算符
-eq :等于
-ne :不等于
-gt :大于
-ge :大于等于
-lt :小于
-le :小于等于
-contains :包含
-notcontains :不包含

進行比較

可以將比較表達式直接輸入進Powershell控制臺,然后回車,會自動比較并把比較結(jié)果返回。

復(fù)制代碼 代碼如下:

PS C:Powershell> (3,4,5 ) -contains 2
False
PS C:Powershell> (3,4,5 ) -contains 5
True
PS C:Powershell> (3,4,5 ) -notcontains 6
True
PS C:Powershell> 2 -eq 10
False
PS C:Powershell> "A" -eq "a"
True
PS C:Powershell> "A" -ieq "a"
True
PS C:Powershell> "A" -ceq "a"
False
PS C:Powershell> 1gb -lt 1gb+1
True
PS C:Powershell> 1gb -lt 1gb-1
False

求反

求反運算符為-not 但是像高級語言一樣”! “ 也支持求反。

復(fù)制代碼 代碼如下:

PS C:Powershell> $a= 2 -eq 3
PS C:Powershell> $a
False
PS C:Powershell> -not $a
True
PS C:Powershell> !($a)
True

布爾運算

-and :和
-or :或
-xor :異或
-not :逆

復(fù)制代碼 代碼如下:

PS C:Powershell> $true -and $true
True
PS C:Powershell> $true -and $false
False
PS C:Powershell> $true -or $true
True
PS C:Powershell> $true -or $false
True
PS C:Powershell> $true -xor $false
True
PS C:Powershell> $true -xor $true
False
PS C:Powershell>  -not  $true
False

比較數(shù)組和集合

過濾數(shù)組中的元素

復(fù)制代碼 代碼如下:

PS C:Powershell> 1,2,3,4,3,2,1 -eq 3
3
3
PS C:Powershell> 1,2,3,4,3,2,1 -ne 3
1
2
4
2
1

驗證一個數(shù)組是否存在特定元素

復(fù)制代碼 代碼如下:

PS C:Powershell> $help=(man ls)
PS C:Powershell> 1,9,4,5 -contains 9
True
PS C:Powershell> 1,9,4,5 -contains 10
False
PS C:Powershell> 1,9,4,5 -notcontains 10
True

一、值比較

1) -eq: 相等(equal)運算符
2)

主站蜘蛛池模板: 久久综合综合 | av手机免费在线观看 | 一区二区三区欧美在线观看 | 夜夜夜精品视频 | h视频在线播放 | 国产欧美在线一区二区三区 | 羞羞视频免费观看入口 | 欧美日韩国产成人在线观看 | 久久在线| 久久精品av| xxxxhdhdhdhd日本| 亚洲一区二区在线 | 久久99精品久久久久久小说 | 欧美久久久一区二区三区 | 国产精品成人av片免费看最爱 | 成熟女人特级毛片www免费 | 香蕉成人在线观看 | 成人在线a| 免费欧美 | av免费在线观看免费 | 69性欧美高清影院 | 成熟女人特级毛片www免费 | av一二三四区 | 成人一级免费视频 | 激情综合网俺也去 | bt 自拍 另类 综合 欧美 | 在线高清中文字幕 | 性高湖久久久久久久久aaaaa | hdhdhd79xxxxх| 国产成人在线视频 | 欧美成人免费电影 | 日韩精品中文字幕一区二区 | 欧美韩国日本在线 | 久久亚洲精品国产一区 | 91av久久| 国产精品视频yy9299一区 | 国产美女三级做爰 | 人禽l交免费视频观看 视频 | 青草av.久久免费一区 | 欧美一区二区三区免费观看 | 91午夜在线观看 |