How to run multiple batch files with one master batch file

If you use start, the other bat-files will create new process for each bat, and run them all at the same time.

cd "\directory\bat1\"
start bat1.bat
cd "\directory\bat2\"
start bat2.bat
cd "\directory\bat3\"
start bat3.bat

But if you want to run the next one after the last one is finished, you can use call

cd "\directory\bat1\"
call bat1.bat
cd "\directory\bat2\"
call bat2.bat
cd "\directory\bat3\"
call bat3.bat

don't forget the first \ at the beginning of the cd , otherwise it will try to change the directory into a subdirectory of the current working directory.


I found a solution! I used this code in order to get the bat to open the three different bat files independently:

cd "\directory\bat1\"
start bat1.bat
cd "\directory\bat2\"
start bat2.bat
cd "\directory\bat3\"
start bat3.bat

So i struggled with this problem, and none of these solutions or other ones worked. What I wanted to do in a "master" batch file was access subfolders and run batchfiles in those folders sequentially. This is what I ultimately ended up doing,

cd Folder1
call batch_cmd.bat
cd ..
cd Folder2
call batch_cmd.bat
cd ..

etc. etc. etc.

This format worked fine for me since I was using javascript/nodejs to generate those commands and batch files.

If you want to do something entirely in batch files then I'd suggest you look up powershell scripts instead.