mardi 27 octobre 2020

Batch error "Goto is unexpected at this time" when using an if statement

It works fine when i hit 5 to go to the quiz but as soon as i put in the first answer it says "Goto was unexpected at this time. I have tried using [] around both sides of the if statement if [%3%] == [whatever] but then it always goes to menu. Please help.

goto menu

:menu
cls              

echo %DATE%             
echo 5) quiz
echo.
set /p input=Enter: 
if %input%== 1 goto class                               
if %input%== 2 goto credit
if %input%== 3 goto limbo
if %input%== 4 goto secret
if %input%== 5 goto quiz                
cls
goto menu

:quiz
cls
Echo Question 1 How big is the Grand canyon?
set /p 1=Enter: 
if Not %1%==1902 goto menu
 pause>Nul 
 goto quiz1



:quiz1
cls
echo What was Fort adams named after?
set /p 2=Enter:
if /I not %2%==jhon adams goto menu
pause>Nul               
goto quiz2

:quiz2
Echo What state has the 24 largest area?
set /p 3=Enter:
if /i %3%== Georiga goto congrats
goto menu

:congrats
Echo Good Job!
pause >nul
exit

Aucun commentaire:

Enregistrer un commentaire