過濾 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