exit /B 0 does not work...

Posted by murxx on Stack Overflow See other posts from Stack Overflow or by murxx
Published on 2010-05-21T11:08:00Z Indexed on 2010/05/21 11:10 UTC
Read the original article Hit count: 211

Filed under:
|
|

Hi,

I have the following problem:

I have created a batch script which calls itself in there (for being able to write a log in parallel). In the script I start another process (like start startServer.bat) which starts up a java process and keeps opened up all the time.

In my original script I wait 30 seconds, check if the process is running and do an:

exit /B 0

Unfortunately that does not work, the window shows that the exit /B 0 is being evaluated, but the window still keeps open. When I close the window with the other process (meaning the "child" processes started up in my .bat) my script continues its run.

So:

scriptA.bat -> in there I call: start startServer.bat -> wait 30 seconds -> check is server is started -> exit /B 0 Process hangs up!

What's very odd, if I wrap another script around, like:

scriptB.bat -> call scriptA.bat -----> in there I call: start startServer.bat -----> wait 30 seconds -----> check is server is started -----> exit /B 0 -> scriptA.bat continues without any hangup!

I also tried the same with exit 0 (without /B) also, same result! In the first case it hangs up, in the second case my window closes as expected...

Has anyone of you ever had such a problem before and knows what's wrong here? Process hangs up!

© Stack Overflow or respective owner

Related posts about .bat

Related posts about batch-file