I have a problem of an input being successful, but not being able to use the IF
command with that input. I have already tried:
if "%input%" equ "s helpme" goto localhost.mail.helpme
I have eliminated the possibility of an error in the :debug function
, an error in the symbol '.'
, and the possibility of an error in the set /p
input section. I am out of ideas on how the code is going wrong.
I know how to solve the common problem of spaces in batch, but for some reason, this code is still not working for me. Here is the code and the output from the debug file:
:: GAME.BAT
set lvl=003
set debug=true
:localhost.mail
call :debug "vdir localhost.mail"
if %lvl% equ 002 goto localhost.mail.help
set /p input=localhost.mail
call :debug "localhost.mail input %input%"
if %input% equ h goto localhost.mail.help
if %input% equ help goto localhost.mail.help
if %input% equ listmail goto localhost.mail.list
if %input% equ l goto localhost.mail.list
if "%input%" equ "s helpme" goto localhost.mail.helpme
if "%input%" equ "show helpme" goto localhost.mail.helpme
if %input% equ e goto localhost
if %input% equ exit goto localhost
:localhost.mail.help
call :debug "vdir localhost.mail.help"
if %lvl% equ 002 echo Advanced to level 3
if %lvl% equ 002 set lvl=003
echo (h)elp - Display this help screen
echo (l)istmail - Lists emails
echo (s)how - Shows an email ex. show helpme
echo (e)xit - Exits email
goto localhost.mail
:localhost.mail.list
call :debug "vdir localhost.mail.list"
if %lvl% gtr 002 echo helpme
goto localhost.mail
:localhost.mail.helpme
call :debug "vdir localhost.mail.helpme"
if %lvl% lss 003 goto localhost.mail
echo WORK IN PROGRESS, COME BACK NEXT UPDATE!
echo.
goto localhost.mail
:debug
if %debug% equ true echo %date% %time% %~1>>debug.txt
GOTO :EOF
:: DEBUG.TXT
Tue 11/20/2018 13:33:05.84 vdir localhost.mail
Tue 11/20/2018 13:33:05.86 vdir localhost.mail.help
Tue 11/20/2018 13:33:05.87 vdir localhost.mail
Tue 11/20/2018 13:33:10.15 localhost.mail input s helpme
At the end of DEBUG.TXT
is where the batch window exited from a coding error.