Kyle Puckett
Kyle Puckett

Reputation: 1

Goto was unexpected at this time please

im messing around for a secret file that i can type in and just keep things to myself here is the code

@echo off
echo PLEASE ENTER THE PASSWORD TO CONTINUE
set /p password="hello"
IF %c%==hello goto top
IF NOT %c%==goto PASSERROR
:passsuccess
title matrix
color 0a
mode 1000
:top
echo %random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%
goto top
:passerror
echo try again

Upvotes: 0

Views: 36

Answers (1)

Magoo
Magoo

Reputation: 80211

Your problem is that c is undefined. You are entering the password into password then checking c.

In case of spaces or no entry, use

if "%varentered%"=="somevalue" goto ...

For instance,

if "%c%"=="" goto paserror

or

if not defined c goto ...

as you have it, if %c% is not equal to goto, execute the executable passerror

Upvotes: 1

Related Questions