Why does only the first line of this Windows batch file execute but all three lines execute in a command shell? Why does only the first line of this Windows batch file execute but all three lines execute in a command shell? windows windows

Why does only the first line of this Windows batch file execute but all three lines execute in a command shell?


Maven uses batch files to do its business. With any batch script, you must call another script using the call command so it knows to return back to your script after the called script completes. Try prepending call to all commands.

Another thing you could try is using the start command which should work similarly.


Having call helps. However today it didn't.

This is how I solved it:

Bat file contents (if you want to stop batch when one of cmds errors)

cmd1 && ^cmd2 && ^cmd3 && ^cmd4

Bat file contents (if you want to continue batch when one of cmds errors)

cmd1 & ^cmd2 & ^cmd3 & ^cmd4


To execute more Maven builds from one script you shall use the Windows call function in the following way:

call mvn install:install-file -DgroupId=gdata -DartifactId=base -Dversion=1.0 -Dfile=gdata-base-1.0.jar  -Dpackaging=jar -DgeneratePom=truecall mvn install:install-file -DgroupId=gdata -DartifactId=blogger -Dversion=2.0 -Dfile=gdata-blogger-2.0.jar  -Dpackaging=jar -DgeneratePom=truecall mvn install:install-file -DgroupId=gdata -DartifactId=blogger-meta -Dversion=2.0 -Dfile=gdata-blogger-meta-2.0.jar  -Dpackaging=jar -DgeneratePom=true