3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Password Batch

Password Batch
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!
 
Remove these adsRemove these ads by Signing Up
 

Step 1What You Need To Know

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...
"cls"
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.
« Previous StepDownload PDFView All StepsNext Step »
16 comments
Aug 30, 2009. 3:48 PMgreyadam25 says:
Thank you for the password tries part i used it for my own batch Program

My Program is Called Program Utiliy's

set tries=6
:top
cls
set /a tries=%tries% -1
if %tries%==0 (
goto penalty
)
Echo You have %tries% attempts left.
Echo Please enter your password to proceed
set /p password=
if %password%==Your Password Here (
echo Welcome Your Name
ping localhost -n 5 >nul
cls
Echo CONNECTED!
pause
cls
) else (
goto top
)
goto top
Jun 20, 2009. 12:38 AMRedFlash says:
I got one!

@echo off
title Login
echo Login
set/p "pass=Password: "
if %pass%==(Your Password Here) goto correct
cls
echo Incorrect Password!
ping localhost -n 3 >nul
attrib +s +h (This file's name)
exit
:correct
echo wow!
pause

That is what I call passwording!

Great job on the instructable
Jun 18, 2009. 10:37 AMwill421 says:
Or you can just place it in the startup folder.
May 28, 2009. 2:39 PMArbitror says:
Could you post that theme?
Jun 1, 2009. 4:10 PMArbitror says:
The Windows theme.
May 25, 2009. 1:57 PMlemonie says:
Well written. Do you get this to start in full-screen mode? (if you do add-in how) L
Jun 1, 2009. 1:20 PMlemonie says:
Yes I know how, I was asking whether you did this - should add it in (if you haven't) L
Jun 1, 2009. 2:32 PMlemonie says:
It needs this to work to the best effect, (windowed it can be ignored or closed) L
May 25, 2009. 1:28 PMPsychic Master says:
how did you change your start menu?
May 26, 2009. 6:06 AMPKM says:
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.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
0
Followers
1
Author:Necrohero