How to Add a Password to a .Bat File

1:13 PM Unknown 0 Comments

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


  1. Add a Password to a .Bat File Step 1.jpg
    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

  2. 2
    Copy the following code:
    :FAIL
                   echo Invalid password
                   goto :end
                   :end
    

               :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. At the end of your program, you need to add:

               

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

0 comments: