Goto was unexpected at this time

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
TokeRaabjerg
Posts: 1
Joined: 08 Jun 2015 10:26

Goto was unexpected at this time

#1 Post by TokeRaabjerg » 08 Jun 2015 10:31

I've had this problem a few times, did some research, never figured it out tho...
The problem is when you enter the wrong password, it doesn't goto "wrongpass"

Code: Select all

@ECHO OFF
MODE CON COLS=55 LINES=6
COLOR 70
TITLE Please login..
ECHO --------------------------------------------------
ECHO : Please login...                                :
ECHO : If you dont know what this is, please exit it. :
ECHO --------------------------------------------------

:: Username section.
:username
SET /P username=Username :
IF /i %username%==Toke goto password
IF /i %username%==Martin goto password
IF /i %username%==Mattias goto password
CLS
goto wronguser

:: Password section.
:password
SET /P password=Password :
IF %password%=="2704005019" goto startprocces
IF %password%==
IF %password%==
CLS
goto wrongpass

:: Wrong login section.
:wronguser
ECHO Wrong username! Please try again...
pause
GOTO username
:wrongpass
ECHO Wrong password! Please try again...
pause
goto password
pause



:: Procces start.
:startprocces
TITLE Loading program...*
CLS
ECHO Okay, the pc you want to crash is now loading it.
timeout 5
ECHO This will take until the timer runs out
timeout /t 30 /nobreak
ECHO Please continue...
pause
cls
ECHO Type "launch" to start the program.
SET /P launch= :
IF /i %launch%==launch goto crash
ECHO Wrong command!
pause
exit


:: The acctaul "crashing" part.
:crash
cls
title Crash program.
ECHO The program will be launched
pause
:loop
start
goto loop
ECHO ERROR!!
pause
exit

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Goto was unexpected at this time

#2 Post by foxidrive » 10 Jun 2015 11:36

Does this help you to see the solution to the problem?

Code: Select all

@echo off
:loop1
set "input="
set /p "input=Type something: "
if /i "%input%"=="yes" echo yes
if /i "%input%"=="no" echo no
goto :loop1

Post Reply