Answers for "batch loops"

8

batch loops

set LoopVar=0
:Loop
echo %LoopVar%
set /a LoopVar=%LoopVar%+1
if not %LoopVar%==100 goto Loop
echo Done!
pause

------------------------------------
            HOW IT WORKS
------------------------------------
set LoopVar=0 <--- Sets the counter to 0
:Loop
echo %LoopVar% <--- Echos Status
set /a LoopVar=%LoopVar%+1 <--- Adds +1 to the Var "LoopVar"
if not %LoopVar%==100 goto Loop <-- Until "LoopVar" equals 100 it repeats the job. (You can change the 100 to any number you would like.)
echo Done!
pause
Posted by: Guest on April-22-2020
2

batch script loop

// batch for loop
for /l %%x in (1, 1, 100) do (
   echo %%x
   copy %%x.txt z:\whatever\etc
)
Posted by: Guest on November-02-2020
2

batch script loop

for /l %x in (1, 1, 100) do (
   echo %x
   copy %x.txt z:\whatever\etc
)
Posted by: Guest on November-02-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language