Today, I will be showing you how to make a password protected file that is created and accessed using a Batch (.bat) file. The method I will be using is very simple, but unfortunately it is not fool proof. Anyone with a little knowledge or experience in computer systems and Batch files will most likely be able to circumvent it rather quickly. However, it should work just fine for hiding things from people with little or no computer or batch file knowledge. 

The first time you open the file it will flash and another file will appear named "Hidden". To hide this file, simply click the original file again and it will ask you if you want to hide the file.  If you type Y then it hides it, but if you type N nothing happens. After you hide it, and later want access, you click the original file again and it will prompt you for a password.  If you get it correct, then it prompts you for another one before allowing you into your hidden file. However, if you get it wrong the letters turn green and fall like in the Matrix, then says " You have tried to access a file that is not yours. Good-Bye." and gives you a countdown. If the countdown reaches zero the computer will shutdown. You can abort the countdown by typing in a third password. The passwords are set by default to 1234, but as we will discuss later, can be changed.

Step 1: Open Notepad

We will be using notepad to type our program. So, the first step is going to be to open notepad.

Step 2: Copy & Pase

Since this is an instructable on making this specific program and not just batch files in general, you simply need to copy the code below, and then paste it into notepad. I give credit to "Tanmay Das" for a shortened and more efficient version of the coding for the random "matrix" fall.

Here is the Code:

title Cyber Attack Weapon System
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Hidden goto MDHidden
echo Are you sure to lock this folder? (Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
ren Hidden "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
echo Enter password to Unlock Your Secure Folder
set/p "pass=>"
if NOT %pass%== 1234 goto FAIL
goto UNLOCK2
echo Enter password to Unlock Your Secure Folder
set/p "pass=>"
if NOT %pass%== 1234 goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Hidden
echo Folder Unlocked successfully
goto End
@echo off
color 02
echo Warning-Virus Initiated total hardrive corruption imminent
timeout /t 5 /nobreak >nul

set count= 0
if %count% == 200 goto shutdown
echo %random%%random%%random%%random%%random%%random%%random%%random%
set /a count=%count%+1
goto tricks

shutdown -s -t 45 /c "You have tried to acces a file that is not yours. Good-Bye."
echo Enter password Start Abort Sequence
set/p "pass=>"
if NOT %pass%== 1234 goto shutdown
echo Abort Inittiated
goto Abort
C:\Windows\System32\shutdown.exe -a
Abort Successful
timeout /t 3 /nobreak >nul
goto unlock

goto end
md Hidden
echo Hidden created successfully

Step 3: Customization

The file is named "hidden " by default. If you want to change the name, you have to look in the code and anywhere it says "hidden" replace with your name of choice. You have to replace it a total of 7 times.

The passwords are set by default to 1234. They can also be changed. To change the passwords find in the code where it says: 

if NOT %pass%== 1234 goto

And replace 1234 with your password of choice. There are 3 different passwords spread throughout the program. I recommend having a different password for each.

If you want to change the amount of "matrix" letter fall find the part of the code that looks like this:

set count= 0
if %count% == 200 goto shutdown
echo %random%%random%%random%%random%%random%%random%%random%%random%
set /a count=%count%+1
goto tricks

Then replace 200 with your number of choice. Increasing the number will increase the length of the "matrix" fall, while decreasing the number will shorten it.

None of the program is permanent.  If you wish to change it after you save it, right click on its icon and click edit. You can now edit the file as you wish, but before you edit it I recommend making a copy of it just in case you mess something up. I personally always make copies of anything I'm programming.

Step 4: The Most Important Part

Once you are satisfied with your program, you must save it as a .bat file. If you do not save it correctly then it will not work.

First, click save as:

Second, name the file whatever you want, but after the name type .bat 
For example, "example.bat"

Last, Click Save

Step 5: Conclusion

Please feel free to modify the file as you wish, and have fun with it!  If you could please post improvements in the comment section below, I would really appreciate it.

Thanks for reading
<p>using </p><p>if %cho%==Y goto LOCK<br>if %cho%==y goto LOCK<br>if %cho%==n goto END<br>if %cho%==N goto END</p><p>Is inefficient use</p><p> if /I %cho%==y</p><p>And the file will not be case sensitive to the input y without the second line.</p><p><a href="https://www.instructables.com/member/batchcc" rel="nofollow">https://www.instructables.com/member/batchcc</a></p><p>:)</p>
<p>I found a way to keep it more hidden....</p><p>Create a new vbs and type this:</p><p><em>X=Inputbox(&quot;Password:&quot;,0,&quot;&quot;)</em></p><p><em>If X=&quot;YOUR PASSWORD&quot; Then.</em></p><p><em>wscript.quit(7)</em></p><p><em>Else</em></p><p><em>wscript(8)</em></p><p><em>End if</em></p><p>Now in you batch file put this</p><p><em>call &quot;filename&quot;.vbs</em></p><p><em>if %ErrorLevel% == 7 &quot;command for right answer&quot;</em></p><p><em>if %ErrorLevel% == 8 &quot;Command for incorrect answer&quot;</em></p><p>I hope this will make it more hidden</p>
<p>Im sorry, what happens if they keep trying and getting the passowrd wrong?</p>
<p>cul </p>
<p>Your code has a lot of unnecessary code (the &quot;echo %random%&quot;).<br>You can shorten that by using a conditional loop.</p><p>Try this<br>set count= 0<br>:tricks<br>if %count% == 100 goto shutdown<br>echo %random%%random%%random%%random%%random%%random%%random%%random%<br>set /a count=%count%+1<br>goto tricks<br>:shutdown<br>cls</p><p>Just a suggestion</p><p>-Tanmay</p>
<p>Thanks again, I tried it, and it works great. I'll edit the instructable to include the shortened version.</p>
Thanks, I've been wondering how I could shorten that part. I'll have to try it when I get some time.

About This Instructable




More by cadepellerin:Password Protected File Using Batch Files How to make a Fake Virus with a Batch File 
Add instructable to: