Reputation: 21
I am working on a small project that asks for input and then does to one of two variables. Whenever I make a choice it always goes to the first choice no matter what I choose. How could I correct this?
echo Do you need to get out fast? (Y or N)
set /p choice=
if %choice% == "Y" goto :Skip
if %choice% == "y" goto :Skip
if %choice% == "N" goto :Next
if %choice% == "n" goto :Next
cls
:Skip
ping localhost -n 2 >nul
cls
start .\App\Quick.bat
goto :eof
EXIT
:Next
ping localhost -n 2 >nul
start .\App\Slow.bat
pause
goto :eof
EXIT
Upvotes: 0
Views: 135
Reputation: 1061
choice
command is a simpler and more efficient way to get user input.
choice /c:yn /m "Do you need to get out fast? (Y or N)"
if %errorlevel% == 1 goto Skip
if %errorlevel% == 2 goto Next
Upvotes: 1