This basically mimics the selection, you will need to put it as a routine in your batch file. I also prefer the choice, but I need something portable that will work on Windows XP.
You can then change this to accept other βoptionsβ, however it will work as case-insensitive and repeat the request until the user explicitly enters Y, y, N or n.
:yesorno set /p choice=%2 if /i NOT %choice% == n ( if /i NOT %choice% == y goto yesorno ) set "%~1=%choice%" goto :eof
Then you call this routine with:
call :yesorno answer "Do you want to continue? [Y/n]: "
It has worked very well for me so far.
Snake
source share