Create a password protected folder without any special software

Posted on 8 January, 2008
This item is filed under [ Miscellaneous, Productivity Tips, Security, Windows XP ]

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’).

Share and Enjoy:
  • E-mail this story to a friend!
  • Print this article!
  • Digg
  • StumbleUpon
  • Technorati
  • Reddit
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • FriendFeed
  • BlinkList
  • Diigo
  • LinkedIn
  • Propeller
  • IndianPad
  • MySpace
  • Slashdot
If you liked this post, consider subscribing to my RSS feed or get future posts delivered through Email


If you enjoyed reading this article, please check out other related articles below:

{ 1 trackback }

How to Create Password-Protected Folder in Windows XP without any Software? | My Tech Quest
July 13, 2008 at 9:57 am

{ 73 comments… read them below or add one }

1 maneesh August 16, 2008 at 5:18 pm

yaa it really worked…..now i can protect my private folders .
thanx.

can any one tell me the lang used.

Reply

2 shabbir August 19, 2008 at 2:52 pm

this is good search i provide you better cosideratin
rply me at this
0300-6565208

Reply

3 James September 6, 2008 at 4:09 pm

please help me..after locking the folder and unlocking it, i cannot view the whole folder anymore..please..please..please…they are all important files!!!

Reply

4 cooldude September 23, 2008 at 9:36 am

dude this is a better way. i just modified the program so that instead when u get the pass wrong then it will ask for the pass again so on so forth. i give credit to mike though. here it is. I changed the names
cls
@ECHO OFF
title lock
if EXIST “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” goto UNLOCK
if NOT EXIST lock goto MDLOCKER
:CONFIRM
echo Are you sure u want to Lock the lock(P/S)
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 lock “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
attrib +h +s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
echo lock locked
goto End
:UNLOCK
echo put in the key to Unlock the lock
set/p “pass=>”
if NOT %pass%==??? goto FAIL
attrib -h -s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
ren “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” LOCK
echo lock Unlocked
goto End
:FAIL
echo Invalid keyword
goto UNLOCK
:MDLOCKER
md LOCK
echo lock unlocked
goto End
:End

Reply

5 man October 14, 2008 at 4:20 pm

dude if i renamethe Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D} folder to any other then the security is gone?

need something more to this to make it use ful.

Reply

6 Shaharyar October 17, 2008 at 7:51 pm

Great and cool work.. ! simply love it!

Reply

7 Alex November 28, 2008 at 2:21 pm

i did it and im no computer wiz and it works fine i actually think its really great and i will use it at school so they cant find my games :P thnx man i will hav to show this to evry1

Reply

8 Bharath December 14, 2008 at 5:31 am

good 1 bro… :)
small tip for people who wan2 see the hidden folder…
click on
tools>>folder options
select view tab..
scroll down, click show hidden files & folders..
then uncheck the row saying
hide protected OS files…(select “yes” wen prompted)
now in the place u hav ur personal hidden folder (i.e the
control panel shortcut)….
select the file & rename it to wat ever u want…

there u r…
all ur files will b shown….
enjoy…!!

Reply

9 REYNAN January 6, 2009 at 9:31 am

Thanks ma’am! Its a good Code. I used it and it works just fine. But its only good for non-techies, geeks can still unhide it and view your files if they want to…

Reply

10 swamykumar January 6, 2009 at 3:55 pm

floder is created but folder cannot lock some one of the file is save at the folder place when bouble click the bit file some other file is save and folder cannot be locked or invisible. I dowdload bat file but i cannot get notepad file so that i can chance folder name and password to folder.please send me feed back or note pad of scripting

Reply

11 EMWrunr January 9, 2009 at 2:26 pm

umm this is super easy to break just edit the batch file’s pwd and bam you have the file. is there anyway to make it so that if you change it, it doesnt change the password the folder is saved under?

Reply

12 Jason January 22, 2009 at 7:10 am

Tnx for the code it will help me a lot… God Bless

Reply

13 sasitha February 13, 2009 at 8:44 am

Plz help! i created everything alright! but something went wrong. now i cant open the hidden folder. I enterd the password. but i the folder doest get opened up. the place where i have stored the key is a separate folder named test1. when i click on properties and check the capacity it shows that the files are there. But i cant open the folder when i enter the password after double clicking the key. why is this?? plz help

Reply

14 Franz24 February 24, 2009 at 10:45 pm

Thanks a lot mate it worked!

Reply

15 devendra March 3, 2009 at 11:17 am

how to creat passwoard in folder?

Reply

16 Abdul March 9, 2009 at 10:10 am

any one how know the installation of oracle in linux operating system.

Reply

17 yogendra singh shekhawat March 16, 2009 at 2:31 am

But after all of these things one can easily access the file
exist in this folder by MS-DOS

>> dir (go to the drive where it is,you can see the name of folder by “dir”)
>> cd Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}
>> dir (it will show the list of folders n files)
>> copy (copy your desirable file to anywhere in pc from where you can access it)

Reply

18 deepakhnair April 8, 2009 at 10:28 am

Oops! Whatever it may be, this script will work or not, it wouldn’t give you any security as you desire for your folder. Assume that the script works fine and your folder got locked. Just go to folder options and select “Show hidden files and folders” and unchecked are “Hide extensions for known file types” and “Hide protected operating system files”. Now you can see your locked folder as a control panel icon which is faded in color and it works as control panel as well, when clicked. All you need is to rename it into something and you can go inside that folder!!! This is because all your script does is nothing but it makes your folder as hidden system folder and change the CLSID to exactly that of Control Panel!! So removing the folder properties and CLSID will work reverse without any need of password. Password is given only for the script to work. And if we need a password, one which sees your script, can also see your password as well.

Reply

19 homer April 9, 2009 at 4:01 am

is there a way to apply this to more than one folder at once?

Reply

20 kumar April 13, 2009 at 12:08 pm

thanks dear its working in my xp

Reply

21 Person Who Needs Help June 7, 2009 at 5:21 am

Ok…I have a brandnew computer, its one step down from the touch screen one. Its an HP Vista and these codes arent working correctly.

I did everything up to the point where you type in “Y”
When I type in Y, it does nothing….

So Im at the point where I have files in the folder, but It wont become invisible, or lock, or ask for a password. This seems to be happining with all the websites Ive been on.

Reply

22 ram June 10, 2009 at 6:42 am

read it word by word
u will get it
Once you copy the code you would also need to change each of the double quotes with your keyboard double quotes.

Reply

23 tata June 15, 2009 at 5:48 am

this is bullshit , when entering a password , u can write any password and the folder will be shown , u can even write asjkdasdhjkashdjkh as a password and the file will be shown.

Reply

Leave a Comment

Previous post: How to change the CHKDSK countdown time

Next post: Firefox: Protect saved passwords with a Master Password