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

前端 未结 3 719
爱一瞬间的悲伤
爱一瞬间的悲伤 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 01:10

    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
    

提交回复
热议问题