Running another program in Windows bat file and not create child process

zhongshu picture zhongshu · Oct 8, 2009 · Viewed 43.2k times · Source

I have subversion server with a post-commit hook to do something.

I want the checkin finish soon, not wait the hook script. But by design, the Subversion post-commit hook script will run until all child process exit, so using somthing like:

start another_prog...

in the hook bat file has no use.

So I want to know how to run another program in Windows bat file which not create child process or let the child process detach from the parent.

Answer

Corey Trager picture Corey Trager · Oct 15, 2009

Synchronous. The second notepad won't launch until you close the first.

notepad.exe c:\temp\a.txt
notepad.exe c:\temp\b.txt

Asynchronous: The second notepad will launch even if you haven't closed the first.

start notepad.exe c:\temp\a.txt
start notepad.exe c:\temp\b.txt

More info about the start command:
http://www.robvanderwoude.com/ntstart.php

EDIT: The following comment was made elsewhere by @zhongshu, the original poster. I'm only copying it here:

start cmd /c doesn't work because SVN post-commit hook will wait for the hook and the child process created by the hook exit. It's the design of SVN. I have found a solution, Please refer: http://svn.haxx.se/users/archive-2008-11/0301.shtml

Assuming that he knows what he's talking about, I'm wrong and...undeserving.