I am trying to create a batch file which runs other batch files in a loop depending on a variable, however after the first batch file execution, the ‘master’ batch file also ends.
What am i missing ?
:loop
if %variable% == 5 (bat1.bat) else (bat2.bat)
goto loop
It’s because you are transferring control to the other batch file which means it never comes back to the ‘master’ one.
You need to use
calllike thisWhich will return control back to the master batch file after the one it calls has finished so it can continue the loop.
Hope this helps