ループの簡単な書き方

You normally would use a counted for loop:

MSH:19 C:\temp\monad > for($x = 0; $x -lt 5; $x++) { do-something }

But here's a neat little trick to save some typing, if you don't care which iteration of the loop you're in:

MSH:19 C:\temp\monad > 1..5 | foreach { do-something }

This is a bloated and slow way to do a for loop, though, so don't use it in scripts.

forループを使うより、配列をパイプに渡してforeachを使ったほうがシンプルだし速い、という事かな?

例えば、こんな感じでIrvineなどに頼らずに自力でダウンロードするとか。

MSH:19 C:\temp\monad > $url="http://www.hoge.com/aaa/bbb/ccc/"
MSH:19 C:\temp\monad > 1..50|foreach {$f=[String]::Format("{0:00}.jpg", $_); $c.DownloadFile($url + $f, $f)}

こういうのをモヒカン族って言うのじゃろか?