So, I am asking the user to make an selection. The point of this question is to catch if the user hit just entered without any input. My plan is to find out if the user entered nothing and just hit entered. If so, then display that it is not a valid option and go back to :START
. The following code does not work - especially the empty input and the input with just space
character. If the user did this invalid thing then I just want to display the message saying it is empty.
Any suggestions on how to handle this issue would be greatly appreciate.
@echo off
:START
cls
echo Choose your option & echo.
echo [P] play
echo [R] rules
echo [M] main menu
echo [E] exit
set /p "cho=->"
if %cho%==e (goto EXIT
) else if /I %cho%==m (goto MAINMENU
) else if /I %cho%==r (goto GAMERULES
) else if /I %cho%==p (goto GAMERULES
) else if %cho%=="" (goto EMPTYINPUT
) else if %cho%==" " (goto EMPTYINPUT
) else cls
echo That is not valid
pause
:EMPTYINPUT
echo This is not a valid option.
pause
goto START