Sunday, September 19, 2010

How to start another batch file in separate process?

Consider a usecase like when you trying to start a apache/tomcat server using a batch file.  After starting the server the batch file will stop thare. Meaning if you have the following in a batch file a.bat,

a.bat:

call c:\Installs\Tomact\bin\run.bat
time
unzip a.zip


then the command unzip and time will never executed. In that case starting a new command prompt and call those command via another batch file is possible and it is easy.

Split the above batch file into two batch files namely a.bat and b.bat with content as follows,

a.bat:

call c:\Installs\Tomact\bin\run.bat


b.bat:


time

unzip a.zip



Now write a another batch file with name c.bat as follows,

c.bat:

start call a.bat
start call b.bat

Now running the c.bat file will run both the batch files will run in separate process and all the commands are executed.

No comments:

Post a Comment