Introduction: Different Method of Adding Password to Batch File


This isntsructable will show you an alternative method of adding a username and password to a batch file. I have not seen very many people use this method before, I learned it when I lost my internet for a while and did allot of playing around with stuff.

I also included bat to exe converter for those of you that are like me out there, lol

Step 1: This Is the Code

@ECHO OFF
TITLE Login Script
COLOR 0a
:USERID
CLS
ECHO Enter User ID:
ECHO > NUL
SET /p USERID=
IF %USERID% EQU Eastern.Dragon GOTO PASSWORD
IF %USERID% LSS Eastern.Dragon GOTO INVALID
IF %USERID% GTR Eastern.Dragon GOTO INVALID
:PASSWORD
CLS
ECHO Enter autherization code:
SET /p PASSWORD=
IF %PASSWORD% EQU Nemraiku22159 GOTO MAIN
IF %PASSWORD% LSS Nemraiku22159 GOTO INVALID
IF %PASSWORD% GTR Nemraiku22159 GOTO INVALID
:INVALID
CLS
ECHO INAVLID LOGIN.....
PING -n 3 127.0.0.1 > NUL
ECHO Please try again...
PING -n 3 127.0.0.1 > NUL
GOTO USERID
:MAIN
ECHO Welcome Nemraiku...
PING -n 3 127.0.0.1 > NUL



You will need to replace Eastern.Dragon with your own personnel username and replace Nemraiku22159 with you own password.

Comments

author
pdiddy0201 made it!(author)2014-03-22

Whats equ lss and gtr for

author
TDJP made it!(author)2010-11-03

Thank you very much

author
Nemraiku made it!(author)2010-11-06

No problem, got tired of everyone else's methods

author
TDJP made it!(author)2010-11-07

Is there a way to hide the password when your typing it in?

author
Prof.+Pickle made it!(author)2013-01-02

Yes, yes there is. I have an instructable on it but you I'm sure you can also implement the FINDSTR command to do it too.

author
Nemraiku made it!(author)2010-11-08

I think so, let me do some looking around after I get outta school, but I gotta get off here for now

author
damwafu made it!(author)2011-02-07

where can i put my password?

author
sk8r4life made it!(author)2011-12-29

How do you apply this to a folder?

author
Prof.+Pickle made it!(author)2012-08-08

You could create a shortcut to a this batch file and then hide the folder (right-click -> Properties -> hiden) and then make the batch file open the selected folder
If %PASSWORD% EQU Nemraiku22159 start FOLDERPATH HERE

That should hopefully work...

author
jbotha1 made it!(author)2011-09-13

How do u make multiple users

author
Prof.+Pickle made it!(author)2012-08-08

Easy, you just add different possible correct usernames and corresponding passwords. E.g Heres my (tweaked) code:

@echo off
Title Login Script
:USERID
color 0a
cls
echo Enter UserID
echo.
set /p userid=
If %userid% EQU USERNAME#1 goto user1
If %userid% EQU USERNAME#2 goto user2
If %userid% EQU USERNAME#3 goto user3
goto incorrect1
:user1
cls
echo Enter Password
echo.
set /p pass1=
If %pass1% NEQ PASSWORD#1 goto incorrect2
goto account1
:user2
cls
echo Enter Password
echo.
set /p pass2=
If %pass2% NEQ PASSWORD#2 goto incorrect2
goto account2
:user3
cls
echo Enter Password
echo.
set /p pass3=
If %pass3% NEQ PASSWORD#3 goto incorrect2
goto account3
:account1
cls
echo Welcome %userid%
::CONTINUE ON FROM HERE
pause
:account2
cls
echo Welcome %userid%
::CONTINUE ON FROM HERE
pause
:account3
echo Welcome %userid%
::CONTINUE ON FROM HERE
pause
:incorrect1
cls
color 04
echo Wrong Username!
ping localhost -n 5 >nul
goto USERID
:incorrect2
cls
color 04
echo Wrong Password
ping localhost -n 5 >nul
goto USERID

About This Instructable

8,681views

6favorites

License:

More by Nemraiku:Different method of adding password to batch fileBatch file to crash a computerHow to make a batch file that file shutdown a computer every half hour of every day
Add instructable to: