📜  PowerShell Where对象

📅  最后修改于: 2021-01-08 02:29:40             🧑  作者: Mango

PowerShell Where对象

PowerShell中的Where-Object根据对象的属性值从集合中选择对象。

使用PowerShell 3.0的启动版,可以通过以下两种不同方式构造Where-Object cmdlet:

  • 对比说明:使用PowerShell 3.0的开始,我们可以添加比较运算符在哪里-Object命令的参数。
  • 脚本块:我们可以使用脚本块指定名称和属性的值和比较运算符。 Where-Object cmdlet返回脚本块语句为true的所有对象。

句法

Where-Object 
[-Property]  
[[-Value] ] 
[-InputObject ] 
[-EQ]  
[]


Where-Object 
[-FilterScript]  
[-InputObject ] 
[]
Where-Object 
[-Property]  
[[-Value] ] 
-Match 
[-InputObject ]  
[]


Where-Object 
[-Property]  
[[-Value] ]
-CEQ 
[-InputObject ]  
[]


Where-Object 
[-Property]  
[[-Value] ] 
-NE 
[-InputObject ]  
[]


Where-Object 
[-Property]  
[[-Value] ] 
-CNE 
[-InputObject ]  
[]


Where-Object 
[-Property]  
[[-Value] ] 
-GT 
[-InputObject ]  
[]


Where-Object 
[-Property]  
[[-Value] ] 
-CGT 
[-InputObject ]  
[]


Where-Object 
[-Property]  
[[-Value] ] 
-LT 
[-InputObject ]  
[]

Where-Object 
[-Property]  
[[-Value] ] 
-CLT 
[-InputObject ]  
[]

Where-Object 
[-Property]  
[[-Value] ] 
-GE 
[-InputObject ]  
[]