user2014235
user2014235

Reputation: 11

I dont know why my batch if and goto isnt working

I dont know why my batch if and goto isnt working it works until the user has to pick a choice to run. The whole thing just shutsdown Here is my script:

@Echo off
:Password  
set input=
set b=
set c=
set /p input=Password:
if %input%==******** goto yes
if not %input%==******** goto no
cls
:yes
cls
echo Access Accepted! Welcome Tucker!
echo.
set /p op=Enter Your Full-Name For Access:
if %op%== TuckerGarySiegel goto home
cls
:no
echo Wrong Password. Access Denied. No Entry.
goto password
cls
:home
color 1f

This is what I think is the problem area

Echo Welcome Tucker!
echo 1) My Batch Files
echo 2) Google Chrome
set /p input=Type Your Selection: 
if %c%== 1 goto batch

if not %c%== 1 goto home


pause
cls
:batch
echo Choose File:
echo 1) Password Script

set /p b=Make Selection: 
if %b%== 1 goto passscript
pause
cls
:passscript

i still need to make the rest

please help

Upvotes: 1

Views: 300

Answers (1)

Luke Z
Luke Z

Reputation: 2409

set /p input=Type Your Selection: 
if %c%== 1 goto batch
if not %c%== 1 goto home

You're setting the variable input but then checking the variable c. Try this instead, which will allow it to work:

set /p input=Type Your Selection: 
if %input%== 1 goto batch
if not %input%== 1 goto home

P.S. you don't need to check an if and an if not. Doing this would be just fine:

set /p input=Type Your Selection: 
if %input%== 1 goto batch
goto home

Upvotes: 4

Related Questions