Advena
Advena

Reputation: 2233

Batch file conditional depending on user response to VBScript MsgBox

I know how to create a MsgBox with .vbs and how to start them with a batch file.

How do I write a conditional in the batch file, such that the flow of execution will depend on which MsgBox button the user clicks?

Upvotes: 3

Views: 299

Answers (1)

SachaDee
SachaDee

Reputation: 9545

Test.vbs :

msgbox("Question",vbyesno,"Title")

Test.bat :

for /f "tokens=*" %%a in ('cscript //nologo test.vbs') do (
set results=%%a
)

if "%results%"=="6" (echo do something) else (echo do another thing)
pause

Upvotes: 2

Related Questions