Create a password protected folder without any special software
In an earlier post I had written about how to create an invisible folder. That’s a method to create a merely invisible folder with no real protection.
Now, here we will see how to create a folder that will not just be invisible, but also require a password to reveal it and open it. The best part is that you don’t need any special software to do this. Just plain old Notepad is all that you need.
Here is the code that you need:
cls
@ECHO OFF
title Folder Personal
if EXIST “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” goto UNLOCK
if NOT EXIST Personal goto MDLOCKER
:CONFIRM
echo Are you sure u want to Lock the 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 Personal “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 folder
set/p “pass=>”
if NOT %pass%==pwd123 HERE goto FAIL
attrib -h -s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
ren “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” Personal
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Personal
echo Personal created successfully
goto End
:End
Now here is what you need to do:
Just copy the above code and paste it into Notepad. Save it by giving it any name you choose. Assuming, the file is called secret.txt, change the extension to ‘.bat‘ so that the new name becomes secret.bat. What you get is a batch file. You could actually save one step by saving the file in Notepad directly as secret.bat by enclosing the file name like this: “secret.bat” . This batch file is the one that you need. You can edit this batch file to change the folder name and the password. To change the name of the folder that is created, change the ‘Personal’ (in bold in the above code) to any another name you choose. Likewise change the ‘pwd123′ (in red in the code) to anything else.
Now let’s see how to use it. Place the file in the location where you would like to create your protected folder. Run the batch file by double clicking on it. This will create a folder named Personal in the same location as the batch file. You can now open this folder and place any files in it. Once you are finished, run the batch file again. You will be asked whether you want to lock the folder. Entry ‘Y’ (for Yes) and hit Enter. The folder becomes invisible. To retrieve the folder, run the batch file again. You will be prompted to enter the password. Enter the password, hit enter and voila! the folder appears.
Important: The batch file acts like a key to open the locked folder. So once you have created and locked a folder, do not keep the batch file in the same location since anybody can open the batch file and view your password. So I would suggest that you keep the batch file in a separate and safe place or better still keep it on your pen drive or flash drive. That way when you want to open the folder just copy the batch file to the location where you have your protected folder and run it.
Do remember that the above method is not intended to act as a substitute for the numerous free and commercial softwares that are specifically designed to provide security and encryption to your data.
Update: I got comments saying the code does not work. Of course I did check it before posting it here. But I have identified the problem. The problem is with the straight double quotes used in the code in this post. Once you copy the code you would also need to change each of the double quotes with your keyboard double quotes. That might seem a lot of work for some. So I thought it would be easier to give away the batch file itself. You can download the file here. (Use right-click and ‘Save Target as’ or ‘Save Link as’).
Was this helpful?8 people thought this was helpful
Comment #1
posted on Sep 21, 2009
By
t-howard
Rank: Apprentice
Rating: 0%, 0 votes
If someone else open/edit the batch file then she will know what is the password, am I right?
Comment #2
posted on May 07, 2009
By
chrstdvd
Rank: Apprentice
Rating: 0%, 0 votes
This code worked to hide the folder but it would not unhide it. I tweaked it and now it works. The major change I made was take the work HERE out by the Password and redirected the code to re-enter the loop for unlock instead of going to to END. Fail worked but it goes by so fast you can not see the message. With the revised code, you will see the msg abt the wrong pass word and have another chance to re enter it. When you get the correct password the folder reappears. It is really a cool batch file. Here is my Version.
cls
@ECHO OFF
title Folder Personal
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
goto UNLOCK
if NOT EXIST Personal goto MDLOCKER
:CONFIRM
echo Are you sure u want to Lock the 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 Personal "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 folder
set/p "pass=>"
if NOT %pass%==dwd123 goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-
08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
Personal
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto UNLOCK
:MDLOCKER
md Personal
echo Personal created successfully
goto End
:End
Comment #3
posted on Dec 23, 2008
i can get to the point where you got to lock it, but when i type y into the page, instead of hiding the file and locking it it creates a file called, ö. can you help me out with that? other than that i worked just like you instructed
Comment #4
posted on Dec 08, 2008
By
stanzsax
Rank: Apprentice
Rating: 0%, 0 votes
hi, i tried this batch file, and put 2 files in there (which were just some jpg images). Anyway, i ran the batch file again and it didn't ask me for the password. just so you know, i'm running on vista, i'm not sure that'd be an issue. i don't think so, but so far... i've gotten to the point where my original Personal folder is lost or just invisible and everytime i run the batch file, it just opens a new one, depending on where it's located i.e. Desktop or if i drag the .bat file in the Personal folder, it creates another Personal folder.... this thing is wack.... anyway, i deleted all those extranneous duplicates, how can i get my original Personal back?
Comment #5
posted on Jul 25, 2008
By
ledmark2
Rank: Apprentice
Rating: 0%, 0 votes
I apprepcaite your code it can create and hide folder but when you run the code for the opening of the hidden folder it will accept any password and the folder will appear.
one thing it would be better if "HERE" in code will be removed (if NOT %pass%==pwd123 HERE goto FAIL). please check about these. thank you.
Edgar G. dela Rosa
TESDA
Comment #6
posted on Jun 12, 2008
By
LaRuby08
Rank: Apprentice
Rating: 0%, 0 votes
i tried your code exactly as you have directed . after several attempts, it didn't work.
it creates a folder Personal however then i double click on batch file and it prompts to secure the folder, i typed Y for yes and then afterwards the folder Personal doesn't become invisible, also, when i double click on the folder Personal it opens instantly, no prompts for passwords.....i really like your codes so could you please fix that error and repost it.
Really appreciate your help, also make the password asterick
thanks.
Comment #7
posted on Apr 30, 2008
By
seeker_89
Rank: Apprentice
Rating: 0%, 0 votes
I found that your post is quite helpful to me but can you help or can i request another set of codes where the password that i type will change in asterisk rather on the real word of the password.
Can you Help with these PC Desktops problems?
PC Desktops
Require Packard Bell Easynote R1938 disassembly...
PC Desktops
i have a acer 5738z, so i have a touch pad off button near...
PC Desktops
How do I get my Namco all-stars pac-man game to use a...
HP Pavilion a1410n (ER890AA) PC Desktop
hej qysh duhet me hii ne messenger me fol veq me kejt qi...
HP Pavilion a1410n (ER890AA) PC Desktop
the smart media tv keeps closing
Solve Your Problem Now!
Chat Live with an Expert
Chat Now
Top Computer & Laptop Repair
(513) 874-3306
We fix and repair laptop motherboard no video, no...
(877) 729-0812
We connect to your computer over the Internet to...