Why doesn't my batch script run all lines?

I want to create a batch script that will run axis wsdl2java.bat for multiple WSDLs. When I create a batch script with just this code:

wsdl2java.bat
wsdl2java.bat

it would run wsdl2java.bat only once. I guess there is something with wsdl2java.bat batch script itself.

Can someone help me figure out what is the root cause of the problem?


For compatibility with Microsoft's COMMAND, Microsoft's CMD has the bizarre semantic that invoking a command script within another command script terminates the invoking command script at that point.

The correct workaround for this is not the START command. Nor is it invoking a subsidiary command interpreter process with CMD (especially erroneously using /K for /C as well). It is — and has been for a couple of decades — the CALL command.

call wsdl2java.bat
call wsdl2java.bat

Use cmd.exe /k filename.bat to launch each batchfile.


If I remember correctly, Windows switches completely to the new batch file when you start it from within another batch file and does not return.

The workaround would be to execute

start wsdl2java.bat

-- again, just from the top of my head. I could not find a reliable source in my short google research.

Update: as JdeBP pointed out, mine is the old wrong way. It may have been too obvious that I have not touched the innards of MSDOS or Windows CMD-shell or whatever it's called these days for some decades.

Update2: jeez, I said "off the top of my head".