How to return exit status from an HTA (vbscript) to the calling Batch file ?
My batch file code
@echo OFF
ec
@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.