Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows batch choice command for Windows XP & 2003

Is there a way to prompt users for input (ie: Yes/No) from a Windows batch script that works on XP and Windows 2003 server? It seems some commands (ie: choice) only work on one OS and not others.

like image 482
Marcus Leon Avatar asked Feb 19 '09 20:02

Marcus Leon


2 Answers

Use the SET command with the /P switch.

like image 56
Nick Fortescue Avatar answered Oct 10 '22 16:10

Nick Fortescue


SET /P RESULT=Y or N?
ECHO %RESULT%
like image 36
aphoria Avatar answered Oct 10 '22 14:10

aphoria