Edit Article

Have you ever wanted to add password protection to a windows batch script? Read on to find out how.

Ad

Steps

  1. 1
    Open notepad by going to Start> All Programs> Accessories> Notepad. Vista and 7 users can just type "notepad", without quotes, into the start menu and hit enter
    Ad
  2. 2
    Copy the following code:
    Ad

 :A echo enter password to activate programme set/p "pass=>" if NOT %pass%== passwordhere goto :FAIL




Add a Password to a .Bat File Step 2.jpg
  1. 1
    At the end of your program, you need to add:
    Ad

 :FAIL echo Invalid password goto :end  :end




Add a Password to a .Bat File Step 3.jpg


We could really use your help!

Can you tell us about
money and finance?
Yes
No
money and finance
how to open a bank account
Can you tell us about
sexual health?
Yes
No
sexual health
how to get tested for STIs
Can you tell us about
microwaved corn?
Yes
No
microwaved corn
how to cook corn in the microwave
Can you tell us about
trapping large animals?
Yes
No
trapping large animals
how to catch or trap a deer
Thanks for helping! Please tell us everything you know about
...
Tell us everything you know here. Remember, more detail is better.
Tips
Provide Details.
Please be as detailed as possible in your explanation. Don't worry about formatting! We'll take care of it. For example:
Don't say: Eat more fats.
Do say: Add fats with some nutritional value to the foods you already eat. Try olive oil, butter, avocado, and mayonnaise.

Tips

  • Change "passwordhere" to the password of your choice.
  • If you are not sure how to create good .bat files see some of my other articles to find out how to make some .bat programmes

Warnings

  • This is a very basic password code. Anyone with knowledge of .bat files will still be able to access it.

Article Info

Categories: Hacks | Windows Passwords

In other languages:

Español: Cómo establecer una contraseña en un archivo .bat, Русский: установить пароль на BAT файл, Português: Como Adicionar uma Senha a um Arquivo .Bat

Thanks to all authors for creating a page that has been read 38,188 times.

Did this article help you?
Yes No

Become
an Author!

Write an Article