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]

January 8, 2008 · 108 comments

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

Enjoyed this post? Share it with others.
  • email
  • Print
  • Digg
  • StumbleUpon
  • Technorati
  • Reddit
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • FriendFeed
  • BlinkList
  • Diigo
  • LinkedIn
  • Propeller
  • IndianPad
  • MySpace
  • Slashdot

Subscribe Now

If you enjoyed this post, you will definitely enjoy our others. Subscribe to the feed to get future posts delivered right to your mailbox or feedreader.

Powered by Thesis

Thesis Theme

An amazing WordPress Theme, nothing beats the versatility and SEO friendliness of the Thesis framework.

From beginners, to the most advanced WordPress developers, Thesis makes it easy for anyone to customize it.


{ 107 comments… read them below or add one }

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

shabbir August 19, 2008 at 2:52 pm

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

Reply

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

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

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

Shaharyar October 17, 2008 at 7:51 pm

Great and cool work.. ! simply love it!

Reply

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

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

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

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

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

Jason January 22, 2009 at 7:10 am

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

Reply

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

Franz24 February 24, 2009 at 10:45 pm

Thanks a lot mate it worked!

Reply

devendra March 3, 2009 at 11:17 am

how to creat passwoard in folder?

Reply

Abdul March 9, 2009 at 10:10 am

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

Reply

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

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

homer April 9, 2009 at 4:01 am

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

Reply

kumar April 13, 2009 at 12:08 pm

thanks dear its working in my xp

Reply

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

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

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

Kush July 22, 2009 at 7:45 pm

did any of you realize that any password will word if it the wrong one.

Reply

Mike July 31, 2009 at 3:38 am

Thanks.. Great Idea.. works perfectly

Reply

Alicks August 14, 2009 at 4:15 am

hey its not working in my PC …i have install xp sp2…. i have save this file as .bat but when i have open it i will close automatically….can u send me real trick plz its urgent ……my id is alicksgohil@gmail.com ……….Thank You

Reply

Rathi September 7, 2009 at 6:00 am

You change all double qotes are your keyboard qotes.

Reply

Rathi September 7, 2009 at 5:56 am

Waw, Thanks.

Reply

Rathi September 7, 2009 at 6:05 am

It have one problem. It accept all password. i give the pw was test. After that i give the wrong pw rathi. That also accepted. Then how is it protect?

Reply

madshark October 7, 2009 at 6:43 am

the problem is within this line

if NOT %pass%==pwd123 HERE goto FAIL

delete ‘HERE’

it will not accept any password except the real one..
these codes sure helps a lot..thanks for sharing..cause sharing is caring..

Reply

Bob October 13, 2009 at 6:24 pm

You are right!, This code only hides the folder

Reply

Selam.S October 13, 2009 at 6:21 pm

Thank you, I have been looking ways to do this for a long time.
It really works, well I had to change the double quotes to the one on my key board.
Awesome

Reply

satyagya November 3, 2009 at 5:38 am

my problem is that i had to format my “c” drive and as hiden folder is shown as a link of control pannel, though i had made the hiden folder in anothr drive, now the link is not visiable. Can i still get my data back. How to access the same.

Reply

satyagya November 8, 2009 at 4:03 am

i had made a folder in my “E” drive and i had to format my “c” drive now the icon for link to control panel is missing, please advice how to locate the foder link.

Reply

Georges December 15, 2009 at 8:12 pm

hi pls can anyone explain how to set exactly a password because it’s right all what i wrote as password open the folder and if i delete the word “HERE” in this line
if NOT %pass%==pwd123 HERE goto FAIL

the code become not working…

so plz help how to set correctly a password ????

Reply

madshark February 28, 2010 at 3:25 am

well then..this is my code


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 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

Reply

mark gitgano December 23, 2009 at 12:12 am

Sir I ask how to change the location (instead of Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}), I want to change other location. tnx

Reply

SAAD IRFAN December 27, 2009 at 2:28 am

hi
when i run the batch folder it will appear the private folder.then when i put my data in private folder and i run the batch file again the folder will not become invinsiable.
plz help

Reply

SinQ January 5, 2010 at 2:32 pm

and yea, if you want it to work all the ” have to be done again -.-’

Reply

shweta February 21, 2010 at 9:41 pm

hey awesome….this is nice…i am in my second year of engineering…got to learn something

Reply

hylim March 1, 2010 at 11:45 pm

the password can see, if anyone know when type the password become *****, so somebody don’t know the password we key in.

Reply

Venkat March 14, 2010 at 3:05 pm

wow.. really helpful… invaluable work.. keep up the good work :)

Reply

ngeng4 March 18, 2010 at 2:20 am

y the folder did not go invisible?

Reply

madshark March 21, 2010 at 8:12 am

may be there are other processed that handle the file in the folder..use unlocker to free the folder from other processed

Reply

Souless April 25, 2010 at 8:58 am

This is not really a BIG safe gaurd. Someone can just right click and edit. And BAM! they see your password right next to the password coding. And this wont protect you from everyone but only those who dont know squat about computers.

Reply

avesor June 5, 2010 at 2:24 am

thats why you need to hide the file and just copy it back when you need to

Reply

rohit April 30, 2010 at 5:43 pm

i tried this code to lock a folder it’s creating a folder but not making it invisible and not locking it after prompting (Y/N)….
could you please help me for this

Reply

Ritika May 22, 2010 at 1:50 am

Hey its working.. n its a great fun.
thnx :)

Reply

rachit May 29, 2010 at 12:57 pm

hello,
my problem is “what if anyone delete the batch file from the system
then how to retrieve the data that was hidden if i didn’t have acess to – internet at that particular time and i need the data urgently?”

Reply

jaydeep June 23, 2010 at 8:49 am

hi sir, this is amazing code to lock the any folder
but there is some prblm that is we can give any psw and file can be visible .

Reply

Shah July 10, 2010 at 8:31 pm

Thank you for the useful code..I tried it and it’s working fine..great!

Reply

Anonymous July 13, 2010 at 10:39 pm

Does it work with Windows 7?

Reply

josh July 14, 2010 at 12:09 pm

IF you search with the right keywords you can still open the files in the folder

Reply

sumit July 15, 2010 at 7:29 am

not a good trick cause if u type wrong password it will open. so not so safe

Reply

James July 21, 2010 at 5:12 pm

Hi i have a folder lock and i forget the password. i went to the MS-DOS and when i finally find the folder i found these ” [DIR] com1.{d3e34b21-9d75-101a-8c3d-00aa001a1652}” but i can not access with “cd com1.{d3e34b21-9d75-101a-8c3d-00aa001a1652}” when i put only “com1.{d3e34b21-9d75-101a-8c3d-00aa001a1652}” it say “access denied” and i also find a file called “desktop.ini” and i find this inside the file “[.ShellClassInfo]
CLSID={2227a280-3aea-1069-a2de-08002b30309d}” can someone help me plaese to open mi protected file is verry important PLEASE

Reply

Tanvi July 23, 2010 at 10:38 am

Hey thanx fr the code..but i’ve a problem…
i tried locking two folders at the same place ..the 1st one was locked then i tried locking the 2nd one but nothing happened after the prompt .. “Are you sure u want to Lock the folder(Y/N)..”
& then when i tried to unlock my 1st folder it didn’t appear instead a new folder was created… so is there any way to recover my 1st folder again????
Please help me…
hope to get an early reply…

Reply

Hameed July 29, 2010 at 1:35 am

If the .bat file deleted how can get back the data’s???

where our files are storing???????

Reply

Leave a Comment

{ 1 trackback }

Previous post:

Next post: