How to Create a Simple Batch Password.

by CallumBatchDevelopment in Circuits > Software

854 Views, 7 Favorites, 0 Comments

How to Create a Simple Batch Password.

ssss.png
Lets say that you are sharing a Computer with someone and you are working on a Batch development Project, If it's fairly Complex or a Large text file then you can easily hide your password, for instance:
My password is hidden among'st one of my several in-depth commands, and my original file is hidden and the copied version is burned to a disk and set to read only, so there isn't anyway to my knowledge that someone can get into my file.
now, To have a password youll need a label to start of with, like this ":pwordmenu" and you'll need a "set /p pw=:" So in context, your batch may look a little like this:
-------------------------------------------------------------
@echo off
:pwordmenu
cls
echo Please type your password Below!
set /p pw=:
if %pw%==password goto "nextlabel"
-------------------------------------------------------------

That is the easiest and most common way of creating a password and to hide your password just move the line that contains "if%pw%==password goto "nextlabel" " to ANY place in your batch file.

Heres a simple password menu i have just Created, please test it out and make any changes you wish!

@echo off
:main
cls
echo Welcome !
echo [1] Start
echo [2] Exit
echo =========
set /p op=Option:
if %op%==1 goto pwordmenu
if %op%==2 goto exit
goto failmenu
:failmenu
cls
echo Wrong selection!
echo Please try again!
pause
goto main
:pwordmenu
cls
echo            Please type your password Below!
set /p pw=:
echo -------------
if %pw%==password goto next
goto failed
:failed
cls
echo Your password is incorrect!
echo.
echo Please try again!
pause
goto pwordmenu
:next
cls
echo your password was correct!
pause
exit
:exit
exit

I hope i have helped you in any way!
please come back tomorrow for another guide to do with batch Development!
Thank you for your time!
Goodbye!