Hey there Instructables community! I'v decided to share to you how to make a very simple Password Batch file that will run through the command prompt. This is my very first Instructable, so please be gentle with the comments, but tell me if theres anything that needs to be added or clarified. Ready? LETS DO THIS!

Step 1: What You Need to Know

First off, you need some basic training in batch scripting if you have no clue as to what your doing!
If you already know, please, feel free to skip ahead to step 2. But here I will give you some of the basic "vocab" you will see in many basic batch files.
To start, you will almost always need to start your batch file off with this first line
"@ echo off" This line allows you to create text in your batch file with the "Echo" command, and it makes sure you don't see the "echo" part while the file is running.
"Echo" command is the syntax that allows for text to be seen in the batch file. simply use this line of code to create any text you wish
"Echo Your Text Here"
The third most common script you will see in this instructable is the "ping localhost" line. What this does is wait a set amount of time (in seconds) until the next line of script can be run. The command is as follows...
"ping localhost -n {time in seconds here} >nul"
Then to close any script of the entire program, depending on where you put this code, use this...
this really doesn't need to be explained too much more.
And finally, before any of this can begin, you must have Notepad open in order to do any scripting.
Pleas continue to Step 2.
<p>What is the password?</p>
You can save yourself lines and lines of script by changing all of the &quot;Ah Ah Ah lines&quot; down to just the following<br> <br> setlocal EnableDelayedExpansion<br> set message=Ah Ah Ah, You Didn't Say The Magic Word...<br> set messageLength=44<br> <br> for /L %%J in (1,1,%messageLength%) do (<br> &nbsp; &nbsp; echo !message:~0,%%J!<br> &nbsp; &nbsp; ping localhost -n .15 &gt;nul<br> &nbsp; &nbsp; cls<br> )
what theam is that
Your code is slightly flawed. For anyone reading this, when you get to the <br> <br>Echo CONNECTED! <br>pause <br>cls <br>) else ( <br>goto top <br>) <br>goto top <br>:penalty <br>echo A <br>ping localhost -n .15 &gt;nul <br> <br>part, change the second 'goto top' to 'exit', and it will close the program if you type the right password in, instead of initially reacting correctly, then going back to the 'enter password' part.
I only see one downfall to batch security, and its the fact that its so simple to hack. Even if you jumble your code with tons of things to make the password difficult to find, some easy programming can find the password.
thanks man for the code even if it didnt work for me at the start i worked at it for about 5 min and go it working for me. thank you
Thank you for the password tries part i used it for my own batch Program<br/><br/>My Program is Called Program Utiliy's <br/><br/>set tries=6<br/>:top<br/>cls<br/>set /a tries=%tries% -1<br/>if %tries%==0 (<br/>goto penalty<br/>)<br/>Echo You have %tries% attempts left.<br/>Echo Please enter your password to proceed<br/>set /p password=<br/>if %password%==Your Password Here (<br/>echo Welcome Your Name<br/>ping localhost -n 5 &gt;nul<br/>cls<br/>Echo CONNECTED!<br/>pause<br/>cls<br/>) else (<br/>goto top<br/>)<br/>goto top<br/>
I got one!<br/><hr/>@echo off<br/>title Login<br/>echo Login<br/>set/p &quot;pass=Password: &quot;<br/>if %pass%==(Your Password Here) goto correct<br/>cls<br/>echo Incorrect Password!<br/>ping localhost -n 3 &gt;nul<br/>attrib +s +h (This file's name)<br/>exit<br/>:correct<br/>echo wow!<br/>pause<br/><hr/>That is what I call passwording!<br/><br/>Great job on the instructable<br/>
Or you can just place it in the startup folder.
Could you post that theme?
the one on my background desktop?
The Windows theme.
O sure. No issue. Thats my next instructable!
Well written. Do you get this to start in full-screen mode? (if you do add-in how) L
when running the command prompt, right click on the top bar, and there should be an option to edit the Defaults, after that look around in there and find an option that says "Full Screen" and there you go!
Yes I know how, I was asking whether you did this - should add it in (if you haven't) L
o, yea i did it, and ok, I'll add it in soon! thanx!
It needs this to work to the best effect, (windowed it can be ignored or closed) L
how did you change your start menu?
Lol, i will be posting how to change the Theme next, so sit tight! <sup>.</sup><br/>
Some constructive criticism: Firstly, the way ping delays your computer is by running a ping command (which takes one second) the number of times you specify. This means "ping localhost -n 5" will take 5 seconds, but "ping localhost -n 0.15" doesn't wait at all- I tested out the message displaying part of your code and it happens pretty much instantly. I did find a command that could delay for fractions of a second but I can't remember what it was- it's in a comment I left on another batch Instructable or Google would probably help you find it. Secondly, I thought I should make sure you realise this won't be an impediment to anyone with a basic familiarity with Windows- they could easily kill the process, or just open the batch file and read out your password in plain text. If you have things you need to keep hidden, at least put them in a password-protected zip file, and if you want to restrict access to your computer make sure you password-protect your account and disable guest accounts etc. If you need to protect against people smart enough to use boot disks you'll need to disable boot from CD and password protect your BIOS as well, but at that point we're getting into serious security territory. That said, well done for writing a mostly-working, functional batch file that demonstrates some useful coding techniques.
Thank You! Again, not very practical, but useful for the lesser versed computer person. I will try better on my next one!

About This Instructable




More by Necrohero:Password Batch 
Add instructable to: