Pages

Calling multiple bat files from a bat file

Earlier I had posted about closing command window that is left open after executing a bat file. This post is about calling multiple bat files from a bat file.

Today, while trying to execute multiple maven builds from a bat file, I observed that only first build one was called and once the first build was over, the execution stopped. Next builds were not called at all. I Did some search and found this. Yeah mvn command is a bat file, I knew that. What i missed was putting a call before the mvn commands:

cd ProjectA
call mvn install
cd ..

cd ProjectB
call mvn install
cd ..


The post linked above goes one level further by checking the %ERRORLEVEL% and exiting the script if any any build fails.

So lesson learnt today :
If you need to call multiple bat files from a bat file, start each bat command with a call

No comments: