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’).
You May Also Be Interested In...
- How to create an Admin account from a guest account in Windows XP
- How to print a list of contents of a Folder/Directory
- How to pin a folder to the task bar in Windows 7
- Creating multiple sub-folders using MKDIR from a command prompt
- How to create a really invisible folder
- Windows 7 GodMode: Access all OS config settings in a single window
- Rename a batch of photos all at once
- Lost your Windows password? Here’s what you can do to get around.
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.



{ 107 comments… read them below or add one }
← Previous Comments
yaa it really worked…..now i can protect my private folders .
thanx.
can any one tell me the lang used.
this is good search i provide you better cosideratin
rply me at this
0300-6565208
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!!!
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
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.
Great and cool work.. ! simply love it!
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
thnx man i will hav to show this to evry1
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…!!
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…
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
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?
Tnx for the code it will help me a lot… God Bless
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
Thanks a lot mate it worked!
how to creat passwoard in folder?
any one how know the installation of oracle in linux operating system.
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)
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.
is there a way to apply this to more than one folder at once?
thanks dear its working in my xp
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.
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.
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.
did any of you realize that any password will word if it the wrong one.
Thanks.. Great Idea.. works perfectly
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
You change all double qotes are your keyboard qotes.
Waw, Thanks.
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?
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..
You are right!, This code only hides the folder
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
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.
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.
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 ????
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
Sir I ask how to change the location (instead of Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}), I want to change other location. tnx
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
and yea, if you want it to work all the ” have to be done again -.-’
hey awesome….this is nice…i am in my second year of engineering…got to learn something
the password can see, if anyone know when type the password become *****, so somebody don’t know the password we key in.
wow.. really helpful… invaluable work.. keep up the good work
y the folder did not go invisible?
may be there are other processed that handle the file in the folder..use unlocker to free the folder from other processed
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.
thats why you need to hide the file and just copy it back when you need to
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
Hey its working.. n its a great fun.
thnx
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?”
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 .
Thank you for the useful code..I tried it and it’s working fine..great!
Does it work with Windows 7?
IF you search with the right keywords you can still open the files in the folder
not a good trick cause if u type wrong password it will open. so not so safe
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
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…
If the .bat file deleted how can get back the data’s???
where our files are storing???????
← Previous Comments
{ 1 trackback }