How to Create a Simple Batch Password.

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!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Share

    Recommendations

    • Indoor Lighting Contest

      Indoor Lighting Contest
    • Make It Fly Challenge

      Make It Fly Challenge
    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest

    2 Discussions

    0
    None
    Yolo PigeonLovetozP

    Reply 2 years ago

    it says the password is password you can tell from this line off code

    if %pw%==password goto next

    when you start the program and press 1 it will ask for the password what you type then is then the variable %pw% that line of code checks what the variable %pw% is and if it is password then go to the function :next

    Yolo Pigeon :)