Different Method of Adding Password to Batch File

9.8K611

Intro: 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.

11 Comments

Thank you very much
No problem, got tired of everyone else's methods
Is there a way to hide the password when your typing it in?
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.
I think so, let me do some looking around after I get outta school, but I gotta get off here for now
where can i put my password?
How do you apply this to a folder?
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...
How do u make multiple users
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