Introduction: Password Protected File Using Batch Files
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.
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:
cls
@ECHO OFF
title Cyber Attack Weapon System
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Hidden goto MDHidden
:CONFIRM
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.
goto CONFIRM
:LOCK
ren Hidden "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to Unlock Your Secure Folder
set/p "pass=>"
if NOT %pass%== 1234 goto FAIL
goto UNLOCK2
:UNLOCK2
CLS
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
:Fail
@echo off
color 02
echo Warning-Virus Initiated total hardrive corruption imminent
timeout /t 5 /nobreak >nul
set count= 0
:tricks
if %count% == 200 goto shutdown
echo %random%%random%%random%%random%%random%%random%%random%%random%
set /a count=%count%+1
goto tricks
:shutdown
cls
:shutdown
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
:Abort
C:\Windows\System32\shutdown.exe -a
Abort Successful
timeout /t 3 /nobreak >nul
CLS
goto unlock
goto end
:MDHidden
md Hidden
echo Hidden created successfully
Here is the Code:
cls
@ECHO OFF
title Cyber Attack Weapon System
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Hidden goto MDHidden
:CONFIRM
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.
goto CONFIRM
:LOCK
ren Hidden "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to Unlock Your Secure Folder
set/p "pass=>"
if NOT %pass%== 1234 goto FAIL
goto UNLOCK2
:UNLOCK2
CLS
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
:Fail
@echo off
color 02
echo Warning-Virus Initiated total hardrive corruption imminent
timeout /t 5 /nobreak >nul
set count= 0
:tricks
if %count% == 200 goto shutdown
echo %random%%random%%random%%random%%random%%random%%random%%random%
set /a count=%count%+1
goto tricks
:shutdown
cls
:shutdown
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
:Abort
C:\Windows\System32\shutdown.exe -a
Abort Successful
timeout /t 3 /nobreak >nul
CLS
goto unlock
goto end
:MDHidden
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
:tricks
if %count% == 200 goto shutdown
echo %random%%random%%random%%random%%random%%random%%random%%random%
set /a count=%count%+1
goto tricks
:shutdown
cls
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.
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
:tricks
if %count% == 200 goto shutdown
echo %random%%random%%random%%random%%random%%random%%random%%random%
set /a count=%count%+1
goto tricks
:shutdown
cls
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
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
Thanks for reading