How to return exit status from an HTA (vbscript) to the calling Batch file

前端 未结 3 712
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-12 00:26

How to return exit status from an HTA (vbscript) to the calling Batch file ?

My batch file code

@echo OFF
ec         


        
3条回答
  •  囚心锁ツ
    2020-12-12 00:49

    @echo OFF
    echo Configuring Test...
    start /wait "" AppConfigurationEditor.hta
    echo %errorlevel%
    if %errorlevel%==0 call TestConfigurationEditor.hta
    

    should get the job done - provided errorlevel is returned as 0 for terminated normally and something else for 'cancelled'.

    The echo %errorlevel% line is simply there for testing, just showing you what's going on.

    start /wait will start the target, and pause the batch until the process finishes. The extra pair of rabbit's ears actually enclose the new window title - redundant here, but best to retain as start otherwise picks the first quoted string from the target (if any) as a window title.

提交回复
热议问题