Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This requires end user press "Enter" key after input and utilizes "set /P":

No Format
@echo off
:Ask
set INPUT=
set /P INPUT=Enter Y or N?: %=%
If /I "%INPUT%"=="y" goto yes 
If /I "%INPUT%"=="n" goto no
echo Incorrect input & goto Ask
:yes
echo YES!
pause
goto exit
:no
echo NO!
pause
goto exit
:exit
echo exit!
pause

This automatically takes user input without need to hit enter key and utilizes "CHOICE":

No Format
@ECHO OFF
set errorlevel=-1
CHOICE
IF ERRORLEVEL ==2 goto 2
IF ERRORLEVEL ==1 goto 1
goto end
:1 
echo Y
pause
goto end
:2 
echo N
pause
goto end
:end
echo end
pause