This can happen if bat1.bat stops abnormally (other than just running to the end, like calling exit) and you can work around this by using a fresh cmd.exe to run each bat file:
start /b /wait bat1.bat
start /b /wait bat2.bat
You could omit it for the last one if there won't follow commands in you bat file.
I had a similar issue where I was calling multiple batch files using the call command but it did not pass back the control to the original .bat file.
I found out that I had an exit command at the end of the batch file which closed the DOS window before going back to the original .bat file and finishing the commands there.
If you want to run batchfiles in sequence you will have to put "start bat1.bat" at the end of each file.
In order to run the multiple .exe files in one go, firstly you need to create .bat file and then add all of your .exe files as below:
And then save as something.bat then give it a run with cmd.
Use
call
:By default, when you just run a batch file from another one controll will not pass back to the calling one. That's why you need to use
call
.Basically, if you have a batch like this:
then it will only output
If you write it like
however, it will output
because after
batch2
terminates, program control is passed back to your original batch file.This can happen if bat1.bat stops abnormally (other than just running to the end, like calling exit) and you can work around this by using a fresh cmd.exe to run each bat file:
You could omit it for the last one if there won't follow commands in you bat file.
Something else to look for:
I had a similar issue where I was calling multiple batch files using the
call
command but it did not pass back the control to the original .bat file.I found out that I had an
exit
command at the end of the batch file which closed the DOS window before going back to the original.bat
file and finishing the commands there.