Solved goto was unexpected at this time.

March 24, 2016 at 18:00:03
Specs: Windows 7
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


See More: goto was unexpected at this time.

Report •


#1
March 24, 2016 at 20:01:37
This won't work because start is not a number.

set /a checkpoint=start

try this:

set checkpoint=start

=====================

M2 Get custom script or take private lessons


Report •

#2
March 25, 2016 at 07:12:13
✔ Best Answer
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.

Report •

Related Solutions


Ask Question