Introduction: Password Generator With Batch
Hey Guys!
I created an awesome batch password generator.Totally batch here is the download and the code.
===================================================================================
@echo off
color 12
cls
echo.
echo Password Generator 3000 (Example)
echo.
echo Write first name.
echo.
set /p fname=
echo.
echo Write last name.
echo.
set /p lname=
echo.
echo Generating password......
echo.
pause
set password=%random%%fname%%random%%lname%%random%
cls
color 21
echo.
echo
%password%
echo.
echo Passwordgenerated!
echo.
pause
:verification
cls
echo.
echo Write password.
echo.
set /p p=
if %p% equ %password% goto correct
if %p% neq %password% goto wrong
:correct
color 12
cls
echo.
echo Password correct!
echo. echo
Your balance %random%.
echo.
pause
exit
:wrong
color 04
cls
echo.
echo Password wrong!
echo.
pause
exit
===============================================================================
Its a fair sized amount of code.In the next few steps i will tell you how i did it.
Attachments
Step 1: Step 1 of 2
In this step i will tell you how i made it happen.
I used the %random% command.
When ever you use this command in a batch file it generates
a random 4 or 5 digit number so i simply set the password to %random%%fname%%random%
%lname%%random%
to produce a random password.Some of you guys might be wondering what is lname and fname
fname stands for first name and lname stands for last name.I set this because not everybody using the password generator will have the same last name and also first name.
Step 2: Step 2 of 2
In this step i will tell you how i actually made it using strings.One of the most popular feature of batch is strings.
We can set any string like i did with set password=%random%.........
I used this almost everywhere in my password generator.
Like set /p name= and also set /p password=
The command that i used to indicate that the password was correct or wrong was the if command by writing
if %p% equ %password% goto correct and
if %p% neq %password% goto wrong
I hope you understood!
Thank you for reading!