How to Lock and Hide Folders in Windows Without Additional Software?
If you are new here, Subscribe to Full Feeds or by Email or follow us in Twitter and receive free daily updates on Office and Windows Tips, Tricks and Tweaks..
I wrote about ‘How to lock your PC automatically while you step out?‘ in my last post. Here is another article regarding privacy. Many try to find and install software to lock and hide private folders in the PC. But here is an easy method of locking and hiding folders in Windows without any additional software.
So, How to Lock and Hide Folders in Windows Without Additional Software?
Follow these steps:
1) Open Notepad and copy the contents of the code below. ( Or Click here to get the code in .doc format)
Update: The code given in earlier link is incorrect, please use this new link in .doc format
2) Change the password by replacing ‘type your password here‘ in the code with your password.
3) Save it as XYZ.bat (Note: Try to be innovative and save it in such a way that it sounds like a system file so that nobody will try to bother clicking it)
Update: If you are not sure how to change the file extension from .txt to .bat, check How to Change File Extension in Windows.
4) Close the file if it is still opened and double click XYZ.bat
5) It will create a new folder called ‘Locker’ automatically. (If you want the file name to be different, find and replace Locker in the code with the name of your choice). This new locker folder will be created in the same hierarchy as the .bat file.

6) Place the contents inside and double click XYZ.bat, it will ask whether you want to lock. Say ‘Y’ and now your folder will disappear.

7) To view again, double click XYZ.bat again and enter your password.
Frequently asked questions:
1. What if I no longer want to hide the folder?
Just delete the XYZ.bat file when the locker folder is in visible mode. Or you can rename the Locker folder to something else and the next time if you double click, it will create an empty Locker folder.
2. What if I deleted the .bat file when the Locker folder is not hidden?
You can download the code again, change the password and create the XYZ.bat file. Now paste that file in the same hierarchy as the Locker folder. It will work as before with the new password.
3. What if I deleted the .bat file when the Locker folder is hidden?
The contents are still there hidden, so don’t panic! Just download the code again, change the password and create the XYZ.bat file. Now paste that file in the same hierarchy as the Locker folder is hidden. Double click the .bat file and you can unlock the Locker folder with the new password.
Note: This trick is only to provide Privacy, so that nobody accidentally opens your private folders. It does not provide any ultimate security. Anybody can open XYZ.bat in any text editor and view the code. As I had mentioned it before try to keep this file in not an obvious place with a name that looks like a system file, so that nobody will have a chance to touch or doubt at this file.



















































Ok, I figured out the problem. This bit of code:
if EXIST “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” goto
UNLOCK
should really be one line. Otherwise it gets confused and can’t figure out what you mean by UNLOCK. Put them on the same line (with a space between goto and UNLOCK), and you should be good.
It doesn’t work on external hardrives…
is it possible to make a new code to make it work on USBs and stuff??
What if u just open da folder called locked then it gives all of the folders you wanted to hide with it
This stuff works thanks if u got any other computer security stuff id be very interested to hear about it
fine idea, but its hiding only the “Folder” name folder, cant we hide other folders in different names? It will be nice if we can hide all folders
Doesn’t work on Vista. It asks me if if I wanna hide the folder, but quickly exits. The folder never locks. If someone could please help me..
Nice , it works
thx.
This works very well in Vista. Excellent code. Thank you very much!
This works really well!
thanks so much.
Wow this is really working !!
Thanks………….
So I’ve been using this code for a couple of months now, and it’s worked fine until today. For some reason, after I enter the password, the hidden folder doesn’t appear anymore. I tried restarting my computer, and it still didn’t work. I tried deleting the .bat file, and adding a new one, and it still does not work. I looked into my recycle bin, but it’s not there, so I didn’t throw it out. I tried advanced searching (search hidden folders) as well, but I couldn’t find anything. I tried opening up some of the documents using Excel, since it was recently opened, but it said that the file could not be found. I don’t think the folder is just hidden, but that it’s locked.
I also tried moving the .bat file into other folders in case I accidentally moved the locked folder elsewhere. But the .bat file won’t even open when I move it into other folders.
I don’t know if this information helps any, but I kept the locked folder in C:\SWSETUP.
Anyways, I am freaking out because I have very very important stuff in that folder.
If anyone knows how to bring the locked folder come back in another way, please PLEASE help! Thanks so much.
@Freaking Out, First which OS is this? XP or Vista?
Since you said C:\SWSETUP, I understand its either HP or Compaq PC. This folder is equivalent of their own temp folder to unpack software before installing. So it is not exactly a good place to keep this. Anyways can you confirm me if there are contents in that folder which were not locked?
This script works very well, except; it can still unlock the folder without valid (matching) password.
Thanks,
Saroj,
Oxford
I have two PC. when I use it with windows XP it works fine. When I do the same with my second computer with windows vista once the folder is hidden I see another folder being created and named: Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}. If I click on it I have access to all the files and folder I want to hide. The folder I want to hide is on a NAS (network hard drive). Any advices?
i typed everything and im done with it but when i saved XYZ.bat and closed the program it didnt make the locker folder…did i do something wrong could you please help me out.
Hi Leo,
You don’t need to type everything. Just copy the file (see ‘click here’ above) on to the notepad, make necessary changes (for eg; pasword) and save it as XYZ.bat.
Hope this helps!
Saroj,
Oxford
Hi Pascal,
I don’t think this script supports vista!
Saroj,
Oxford
Thanks for helping me out last time, Mr. Byte.
Can you use this code for a folder inside a flash-drive? I’m guessing no…
Awesome tutorial!
This method is not good, because if you uncheck “hide protected system files” in “folder and search options” the folder will appear and u can access it without a password
hey “freaking out” just go to “folder and search options” and uncheck “hide protected operating system files” and the folder must appear again and u can access it directly (i hope)
try it and let me know
THis works very fine wid WINDOWS 7 too…mate…gr8 post…
hey its not good to use, i used this n believe me it lacks to hide ur private files like in vista u can open it from tools folder option n uncheck the procted option n it will b visible n also right click on the bat file to get the password is not secure if it is plz share
Hi Mr. Byte,
I have modified the file extension from .doc to .bat
But, when I try to open up the .bat file, nothing happens. A command prompt kind of window just opens for a fraction of sec and closes. No folder is created.
Please help me yaar
To see the “locked” folder, simply do the following:
Open my computer > Tools > Click the View tab > scroll down and find “Hide protected operating system files” uncheck that > press apply > press ok.
Now go to the folder that contains the “locked” folder and you can see the so called “locked” files.
Well this works almost perfectly. Except one can use ANY password whatsoever to access the Locker folder…
Might at least keep teh n00bs away…
hi there,
i tried very long back this code, in this there is a problem when it is used in windows vista, after locking when u goto tools, folder option
and select the show the hidden files option, than the locked folder is shown. than everybody can be seen.
if you have any remedy for this please send me the answer,
good day