Using a DOS batch file I'd like to display a popup window in XP and Windows 7 where I display a message and give the user the choice to press one of two buttons - one would stop the DOS batch file, while the other button would allow it to continue. Any hint on what dos batch command/pgm I may use?
Asked
Active
Viewed 6,386 times
2 Answers
2
The following WSH/VBscript snippet prompts the user to click yes/no, after which you can base logic on the response:
'enter this text into ask.vbs
dim input
input = MsgBox ("Do you want to continue?", 4)
'wscript.echo input
If input = 7 Then
'answer was no
End If
If input = 6 Then
'answer was yes
End If
Then in your batch file, call wscript ask.vbs
.
However, I recommend staying in pure console for this task if you can, as choice
and set
can handle this nicely as Anders suggests. pause
works very well too, and that's usually what I use for a binary choice like yours because it's the simplest approach.

Marc
- 11,403
- 2
- 35
- 45
1
To display an actual window you would have to call something external, a .exe or a Windows Scripting Host script.
If you want to stay in pure batch, echo
the choices and use SET /P
to wait for input from the user. (To support DOS and Win9x you would have to use choice
and not set
on those systems)

Anders
- 97,548
- 12
- 110
- 164