Powershell - ForEach Loop


Advertisements

The following scripts demonstrates the ForEach loop.

> $array = @("item1", "item2", "item3")
 
> foreach ($element in $array) { $element }
item1
item2
item3
 
> $array | foreach { $_ }
item1
item2
item3
powershell_looping.htm
Advertisements