过滤 Where-Object 在哪里
使用条件表达式筛选枚举
别名:
Where-Object
where
?
例:
$names = @( "Aaron", "Albert", "Alphonse","Bernie", "Charlie", "Danny", "Ernie", "Frank")
$names | Where-Object { $_ -like "A*" }
$names | where { $_ -like "A*" }
$names | ? { $_ -like "A*" }
返回:
Aaron
Albert
Alphonse