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.














Great one. This is really something different. Need to try this one out.
Nice one
doesn’t work for me
good idea tho
@shoot, Thanks for pointing it out…some character were missing in the earlier attached format…Please use the new attachment.
Good idea
Nice tip. Stumbled.
Good tip man .
Windows has a built-in utility to build executables from .bat files; if that was done with this, it would reduce anyone’s ability to inspect the code.
The new attachment also did not work for me. No new file was created..:(
@Andrew Johnson, Which OS are you using? I verified this new file in a different system and it works for me…I hope you are saving the file as XYZ.bat and not like XYZ.bat.txt…If you can explain more like what are you getting I can help then…
Fyi……….
Abt the lock and darwback !
1> If u delete the bat file you will miss the folder
2> After folder get locked , bat file - right click and open with notepad
you can view the password.
Any way not bad - !
Friends
I am not a software pg , could u plz update me
Which language is this …..
@Subbu, I am aware of what you have mentioned and that’s what I have mentioned in the last para of my post…abt the language of the program you have mentioned, its just the system commands that are put together to perform this function. If you want you can execute each command individually in manual mode to perform the same function…
Hello Mr Byte,
Thank for the detail!
One more thing .
Is it possible to rectify these drawbacks?
1> If u delete the bat file you will miss the folder
2> After folder get locked, bat file - right click and open with notepad you can view the password.
This will only make the folder invisible and provide it with a bogus name. It’s still accessible when typing the full path directly, or when ’show hidden files’ and ’show system files’ are enabled (what a lot of people do these days).
Locking a folder is something completely different…
@donjohnson, When it is locked it will not be accessible when you type the full path and also when you lock and hide it will not be visible even when ’show hidden files’ is enabled…. Try it out and you will know what I mean…
hi,
i have a bug i guess
after existing Locker folder, i run .bat file and hide folder. then Locker folder disappears.
after these steps, if i create a new folder that has name “Locker” same as old folder, and i run .bat file; old folder Locker does not return. Instead of this the control panel’s shortcut is created.
But if i delete folder that i created as “locker”, than i run .bat again, enter password; real old Locker folder returns.
i hope i described well.
thanks
one workaround for people opening the .bat file to see the password can be that rename it to something else(other than .bat)and whenever u need to access the folder rename it to .bat .. I know this is not feasible if you use it very often. but still if you need security…
Excellent. If you could explain the technology behind this (I mean what each one of those native command does), I will try to make a program out of it.
I love this, i always used a software to do this, thnx alot i dont any need any now! thnx
It accepts any password you enter.
Can I suggest replacing the line after “echo Enter password to Unlock folder”
with
set /p input=”Please enter the password: ”
set /a count=count 1
if (%input%)==() goto FAIL
if not (%input%)==(hardhed) goto FAIL
Change “hardhed” to a word of your own choice.
Although the portion of script I found and resolves the password issue, you can still right click and edit to find password. I’ve attempted to convert it from a batch file into an exe file but havent been successful yet. By doing so it would rectify the right click edit issue. Any ideas would be helpful
tnx..i learned something today..great!
great work - thx - a cute piece of work just what is needed for a simple approach - never going to beat a hacker but keeps things simple
Is there any way by using regedit only?
thanks.
NOT work in my pc
it not create any folder .nice trick
cls
@ECHO OFF
title Folder Locker
if EXIST “Control Panel.{21EC2020- 3AEA-1069- A2DD-08002B30309 D}” goto UNLOCK
if NOT EXIST Locker 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 Locker “Control Panel.{21EC2020- 3AEA-1069- A2DD-08002B30309 D}”
attrib h s “Control Panel.{21EC2020- 3AEA-1069- A2DD-08002B30309 D}”
echo Folder locked
goto End
:UNLOCK
echo Enter password to Unlock folder
set /p input=”Please enter the password: ”
set /a count=count 1
if (%input%)==() goto FAIL
if not (%input%)==(whodear) goto FAIL
attrib -h -s “Control Panel.{21EC2020- 3AEA-1069- A2DD-08002B30309 D}”
ren “Control Panel.{21EC2020- 3AEA-1069- A2DD-08002B30309 D}” Locker
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Locker
echo Locker created successfully
goto End
:End
above is the entire code to use. Read through the code and replace the word “whodear” with one of your choice. The word you choose will be your password.
Just open notepad and paste the code inside. save it as locker.bat. A bat file will appear on your desktop. Double click on the .bat file and the cmd prompt window will appear. type your password in and press enter. Your folder will then appear underneath the .bat file on your desktop. To hide the folder again just double click on the .bat file again and the cmd prompt window will ask you if you want to hide the folder. Press “Y” or “N”. Y=yes and N=no.
Have you ever wondered, how can you make a folder invisible without even using any kind of softwares?
Well, here is the answer to that. It is very much possible and Windows will help us in doing this.
How? Lets see the answer
Code:
[list]
1. Create any new Folder or file.
2. Right click and go to Rename, remove the content, press “Alt” and type “0160?. The Folder name would become NIL.
You must use the number pad on your keypad in order for it to work. If you own a laptop without a keypad, I suggest you create it on a desktop and then transfer it over to your laptop.
3. Now go on to the properties of the folder and click “Customize”, and click “Change Icon”.
4. Here you will find some icons without any kind of images.
5. Select any of these images and click “OK”. You will now see that your folder is now invisible.
[/list]
This works with XP. I haven’t tested it with Vista yet. Also, this method works also with any type of file, not just folders. Such as the .bat file that you created in the tutorial above. also, Pressing Ctrl A should highlight where the folder was placed on your desktop.
on vista (dont know about xp)
all it does is make the folder a hidden folder
is there a way to encrypt folder when you hide it. i like this
lock folder approach
it makes a new file but double clicking it does not open command prompt window…..
so it does not work…
any solutions for that
This is excellent! But I have one small question, how do you change the password?
HELP!!! I used this and it was working, then one day the folder disappeared and when i tried to recover it all i got was a link to the control panel and i DON’T KNOW WHAT TO DO! Please help me out.
Every one knows how to crack it. Now what is other option for locking folder, is using other system. and used with regedit class keys.
sorry to all this is very simple way to hidden files it work just for beginners! this bat file run attrib command and hidden folder( h) and change it to a system file ( s) and rename (ren) it to (Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}) simply if you go to: tools-folder options -view there are “Hidden files and folders” put radio buttom to
“show hidden files” to show hidden files and then click on “hide protected operating system files” to remove check mark
press ok now you can see (Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}) now just rename it locker or d or f or anything els!!! and see or delete all files on it run “cmd” type attrib -h -s [file or folder name]
to undo hidden and system attribution .
but it was fun
there is a problem with this code
In line no 9 it should be set/p “echo=>” instead of set/p “cho=>”
Hey there is a really simple way of protecting the password… get the program Bat_To_Exe_Converter, it is not a really fancy program, but it does make the bat a little more protected, but when you do that you can no longer change you password. so that is one downside
hey, i have a question, i am making a complete program that will install and uninstall everything, but when i convert to .exe i can’t change the password. i want to be able for my fiends to change the password while in the command prompt, is that possible? and i also made a batch file(which later i will convert to a .exe) that will install the proper files that i had made along with the original that hid the folder. i will be putting this program on a cd, and if it detects that it is already installed it will delete it. i have also made a few .vbscript files that creates a message when something is complete. example: when it is done creating a folder it will pop up a message that will say, folder created successfully. but the only thing i cant seem to do is the password thing, please help!!!!
friends i have made a batch file to gurd a folder but unfortunately my key for that folder was deleted so kindly give me advise how i can recover my data saved in that folder.
This is not good tricks for me.when anybody rename the folder,the folder make a normal folder.
I have modified the code a little bit to hide password and have dialogue box to unhide it… works fine…
I mean hide password while typing(not in batch file)…
If the guy have got a brain. He’ll come to know about the secret. Its just adding the following extension to folder .{21EC2020-3AEA-1069-A2DD-08002B30309D} , folder can be opened when ever that extension is removed by renaming the folder…
well..the folder “locker” has appeared. when i double click on the .bat file again, i get the message “are u sure u want to lock the folder (y/n)” nothing seems to happen after i enter “y” or “Y”.. wts the problem??
@ajaaibu, thats exactly what I had mentioned in the bottom note in non technical terms. This is just to make sure that nobody accidentally opens in your private folder. Anybody can crack it down if that person is sitting down in front of your computer with the intention of finding the hidden folder.
woooow!!!
this is a good thing!!!!
is there any other ways like this to hide a folder and open it only with pass??
cheers this is gud, im usin it my self!!
but i heard there r simple ways of hackin into this! is this true?
Is there any way to make this lock a folder of your choice?
Also, “vinal”, there is a very simple way to hack this.
If you know ANYTHING (really) about batch files, you can edit the batch, and change the password, just like you did at the beginning.
Hi,
Can somebody help me with the problem….
I have hidden my folder with batch file programming. My company had installed a domain (Administrator)on my PC. Now the folder which I have locked is not accessible to me. I can not copy this to any other drives. When I click on any file it shows “ATTRIBUTES : Encrypted”. Can somebody suggest me how to unencrypted my folder so that I can copy the folders to another drive. I have used simple methods from Microsoft help.
Please people HELP ME!!!!!!!
URGENT
Nobil Vargghese
Hi!
I did everything and it all worked out!
But when I double click xyz again to view the contents of the locker folder (and I expect it to ask for the password) it says if I want to lock the folder (Y/N) which is the same thing it said in the beginning. It keeps on doing that, and never asks for a password, so in other words, I cannot view the stuff I put inside the locker folder because when I open it, it says it’s empty. !!! What can I do???
this is cool, but don’t work too well on vista.
here are some issues and some help:
1- if in vista you cant use this in program files because you need rights to create folders, try right click run as admin.
2- if in vista the file is still accessible normally( i have show hidden files enabled and show system files, so I could still see the folder, its simply renamed. opened it up like normal)
still its nice and simple
grt software dude….
it realy works i have tries and its nice trick to have some sort of security
wath about to convert this code to some *.exe file, so u cant open it in notepad… ???
I used the .bat file to unlock a folder on my external hard drive. But after locking the folder i completely formatted my operating system (vista) and re-installed it. Now when i am trying to unlock the locked folder on my external hard drive, i am unable to unlock it.
I know there will be a work around for this.
I will greatly appreciate if any one can provide me a solution for this.
I lost more than 60GB of data because of this.
Thanks.
How to reverse this.
@To all,
I have updated the article with some pics for better understanding and have added some more notes on FAQ.
What if I no longer want to hide the folder?
What if I deleted the .bat file when the Locker folder is not hidden?
What if I deleted the .bat file when the Locker folder is hidden?
If there are any other question, drop your comments.
Thanks!
good alternative is http://www.truecrypt.org
hey guys, man you saying to put the code , or the bat file away , that no one could reach/see it… why wont you hide it too, make it hidden, and if you want to open your folder , you just right it up there “d:/locker” and then it will ask the password and ….. so you would have the bat file and the folder at the same place.
*its not an ultimate security, just not let any one pay attention to the private folder.
How can we make the Locker file open up on a network drive instead of on the desktop?
The “locker” folder seems be locked by redirecting you to the control panel folder.
The simplest way to break the lock is rename the folder to anything u wish and all its contents are available.
My recommendation: Never use this to lock your folders.
nice one…..
will this work with all Windows OS?
I am running Vista 32 bit home premium.
This is a really good idea!
Except it doesn’t seem to work :S
Once i lock the folder and it hides,
i can’t seem to open the .bat file
I double click it but it just doesn’t show up
But thanks anyways !
this code is not useful for windows vista plz send me the solution for that
its ok i can finally opened some .bat, but if i click again the .bat it wont go to the (are you sure you want to lock the folder) there are no command that out it only goes this
bad command or file name
Directory already exist
Locker created successfully
hmmmmmmm can u pls help me for this
Man you are owesome!!It works perfect! Thank you
it accepts any passwords ………..