Hi friends,
Here we have discussed about how to use a for loop inside a for loop ie. nested For loop and the syntax is
FOR %%A IN (set) DO FOR %%B IN (set) DO Command
examples:
simple nested.bat
@echo off
FOR %%A IN (1 2 3) DO FOR %%B IN (A B C) DO ECHO %%A%%B
pause
simple nested - using goto.bat
@Echo Off
Setlocal
For %%A in (1 2) DO (
Echo Outer loop %%A
call :inner
)
pause
goto :eof
:inner
For %%B in (A B) DO (
echo Inner loop Outer=%%A Inner=%%B
)
Previous for loop links
Normal for loop: • For /R, For /D, For /L Loop in Batch File ...
for /f: • If/Else, Nested If/Else Statements in Batc...
Please subscribe and stay tuned for more technology updates. Thank you
On this page of the site you can watch the video online Nested for loop/ for loop inside for loop in Batch File Programming with a duration of hours minute second in good quality, which was uploaded by the user Ritwik Dasgupta 13 March 2018, share the link with friends and acquaintances, this video has already been watched 4,185 times on youtube and it was liked by 47 viewers. Enjoy your viewing!