How to return exit status from an HTA (vbscript) to the calling Batch file ?
My batch file code
@echo OFF
ec
You have to return the result of the pressed button as Exit Code that can be recuperated in the errorlevel, with Wscript.Quit [Value] in your two Hta code (or in the first if you just want to check the first)
Exemple :
Test.vbs
result=Msgbox("Are you sure?",vbokcancel, "")
WScript.Quit result
runtest.bat
@echo off&cls
cscript Test.vbs
if %errorlevel% Equ 1 Echo Process OK
if %errorlevel% Equ 2 Echo Process canceled