I am trying to learn batch by writing simple programs, but I had a problem that is completely stopping me. I figured out that it kept crashing on the nested if statements, but as soon as I removed the nested part, it worked fine.
set questionNumber=1
if %questionNumber%==1 (
set /p answer=Test?
if %answer%==yes (
echo hi
)
)
pause>nul
setlocal enableDelayedExpansion
set questionNumber=1
if %questionNumber%==1 (
set /p answer=Test?
if !answer!==yes (
echo hi
)
)
pause>nul