ループ

foreach

 $nums = @(1,2,3)
 foreach ($n in $nums) { write-host DEBUG: $n }
 
 DEBUG: 1
 DEBUG: 2
 DEBUG: 3
 foreach ($sv in Get-Service | select -First 3) { write-host DEBUG: $sv }

for

 for ($i = 0; $i -lt 3; $i++) {
     echo "DEBUG: $i"
 }

ショートハンド

 1..3 | % { echo "DEBUG: $_" }

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS

Last-modified: 2022-12-17 (土) 07:07:48