Get the App
SLTechnology News&Howtos  ›  Servers  › 

Example of PowerShell for Loop statement

Shulou Source: shulou.com Published: 2022-06-02 07:07:14 10月05日 Update

Example one

For ($counter = 1 loop number counter-le 10% counter +) {"loop number $counter"}

Example two

For ($I = 1; $I-lt 99; $I-counter +) {for ($counter = 0-counter-lt 5) {if ($counter-eq 2) {continue} Write-Host "processing item $I-counter"}}

Result

Processing item 94,0processing item 94,1processing item 94,3processing item 94,4processing item 95,0processing item 95,1processing item 95,3processing item 95,4processing item 96,0processing item 96,1processing item 96,3processing item 96,4processing item 97,0processing item 97,1processing item 97,3processing item 97,4processing item 98,0processing item 98,1processing item 98,3

For more information, you can also refer to the Wechat official account below.

Tags: Examples public content more results references statements loops Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei macOS MySQL MariaDB OPPO Reno