I have the following batch script for running all the files in a directory .However this script is an infinite loop and keeps on repeating . is there a way to stop the script when it finishes the last batch file the following is my script
@echo off
for /R %%x in (*.bat) do (
call "%%x"
)
pause
Since you're including this script in your current directory, it is run with the others: recursive/infinite call.
Either put this script one level up, cd in the directory of the bat files and call it with ..\yourscript.bat
Or you could filter out the current script in your loop:
@echo off
for /R %%x in (*.bat) do (
if not "%%x" == "%~0" call "%%x"
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With