1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-23 10:42:07 +02:00
tldr/pages/windows/for.md
Emily Grace Seville c52cc074d9
windows/*.md: make placeholders more compatible with CLIP ones (#9872)
* Make placeholders more compatible with CLIP ones

* Update pages/windows/doskey.md

Co-authored-by: Jack Lin <blueskyson1401@gmail.com>

* Update pages/windows/doskey.md

Co-authored-by: Jack Lin <blueskyson1401@gmail.com>

---------

Co-authored-by: Jack Lin <blueskyson1401@gmail.com>
2023-02-20 15:23:49 +08:00

849 B

for

Conditionally execute a command several times. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/for.

  • Execute given commands for the specified set:

for %{{variable}} in ({{item_a item_b item_c}}) do ({{echo Loop is executed}})

  • Iterate over a given range of numbers:

for /l %{{variable}} in ({{from}}, {{step}}, {{to}}) do ({{echo Loop is executed}})

  • Iterate over a given list of files:

for %{{variable}} in ({{path\to\file1.ext path\to\file2.ext ...}}) do ({{echo Loop is executed}})

  • Iterate over a given list of directories:

for /d %{{variable}} in ({{path\to\directory1.ext path\to\directory2.ext ...}}) do ({{echo Loop is executed}})

  • Perform a given command in every directory:

for /d %{{variable}} in (*) do (if exist %{{variable}} {{echo Loop is executed}})