Computing Staff
  • 0

Goto Was Unexpected At This Time.

  • 0

Whenever I tell the program to go to correct1 it says goto was unexpected at this time.

@echo off
cls
set /a checkpoint=0

:start
set /a checkpoint=start
cls
echo You are in a dark room.
echo You see a “light switch”.
set /p choice=Enter:
if %choice%==turn on light switch goto correct1
if %choice%==manual goto gamemanual
:gamemanual
cls
echo These Are The Possible Commands:
echo.
echo -turn on “object name”
echo -go to “place”
echo -more to come…
pause >nul
goto %checkpoint%
:correct1
cls
echo *This is how the ame will be… You will be looking for clues through different
echo scenarios.
pause >nul
exit

Share

1 Answer

  1. Replace

    if %choice%==turn on light switch goto correct1

    with

    if “%choice%”==”turn on light switch” goto correct1

    A string with spaces must be enclosed by double quotes. This is the cause of your error while what M2 says is anyway right.

    • 0