Tuesday, November 28, 2006

Two ways of writing foreach

There are two ways of creating foreach statements in PowerShell

$b = 'hans','soren','ib','poul','hanne','william','ann-marie'
$b | Foreach-Object {Write-Host $_}

Or

$b = 'hans','soren','ib','poul','hanne','william','ann-marie'
Foreach ($a in $b) {Write-Host $a}

1 comment:

Anonymous said...

thanks.
simple and clear