Powershell - ForEach 迴圈



下面的指令碼演示了 ForEach 迴圈。

> $array = @("item1", "item2", "item3")
 
> foreach ($element in $array) { $element }
item1
item2
item3
 
> $array | foreach { $_ }
item1
item2
item3
powershell_looping.htm
廣告
© . All rights reserved.