From 6920317eec97680057f854572bd9ebd4f92becc7 Mon Sep 17 00:00:00 2001 From: Emily Grace Seville Date: Mon, 13 Dec 2021 00:29:08 +1000 Subject: [PATCH] for: add page (#7442) --- pages/windows/for.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 pages/windows/for.md diff --git a/pages/windows/for.md b/pages/windows/for.md new file mode 100644 index 0000000000..480034512a --- /dev/null +++ b/pages/windows/for.md @@ -0,0 +1,24 @@ +# for + +> Conditionally execute a command several times. +> More information: . + +- Execute the specified commands for the specified set: + +`for %{{variable}} in ({{item_a item_b item_c}}) do ({{echo Loop is executed}})` + +- Iterate over range: + +`for /l %{{variable}} in ({{from}}, {{step}}, {{to}}) do ({{echo Loop is executed}})` + +- Iterate over files: + +`for %{{variable}} in ({{file_a.ext file_b.ext file_c.ext}}) do ({{echo Loop is executed}})` + +- Iterate over directories: + +`for /d %{{variable}} in ({{directory_a/ directory_b/ directory_c/}}) do ({{echo Loop is executed}})` + +- Perform a command in every directory: + +`for /d %{{variable}} in (*) do (if exist %{{variable}} {{echo Loop is executed}})`