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

前端 未结 7 605
悲哀的现实
悲哀的现实 2020-12-01 12:46

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-commi

7条回答
  •  执念已碎
    2020-12-01 13:19

    You can create a hybrid batch/JScript file (i.e. a batch file able to run embedded JScript) where the JScript part will run another_prog in detached mode with shell.Run(prog, 0, false):

    @if (@X)==(@Y) @end /* JScript comment
        rem put any batch code that runs before another_prog here
        @cscript //E:JScript //nologo "%~f0" "another_prog" 0 false
        rem put any batch code that runs after another_prog here
    
        exit /b %errorlevel%
    @if (@X)==(@Y) @end JScript comment */
    
    var ARGS = WScript.Arguments;
    var shell = new ActiveXObject("WScript.Shell");
    shell.Run(ARGS.Item(0),ARGS.Item(1),ARGS.Item(2));`
    

提交回复
热议问题