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.



















































[...] How to Lock and Hide Folders in Windows Without Additional Software? [...]
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 ………..
To take this a step further, I then changed the file extension of the xyz file to something completely different then I deselected the show file extension option. So unless you re-enable the show file extension option and know what extension to make it, it should be fairly safe from prying eyes.
If I re-install My os (XP SP2) will the locker be visible again (if it is saved in other drive than windows).
Ajeet, how did u modify the code to make the password hidden while typing?
PPL don freak out if you dont see the folder right away, you can still see the folder if you go to Windows Explorer and browse to it with the Tree view.
I wish It was hidden from there too..
well….i did not read all the posts here..but one thing i concluded here is that if someone else knows this technique he will definitely delete the batch file and make a new batch file with a new password and open ur folders…lolz…so is there any other method to avoid this thing/.?? or can we just change the extension of the batch file to some other..
ANSWER AND SOLUTION for opening with any password is…
u must copy the code exactly and be careful that u have typed ur password in the …..type ur password here….and then there must be a space between ur password and GOTO…
otherwise it will be opened by any password….lolz…
plz help..
it all worked but after one week i wanted to lock a file..so they told me that it was disabled..
how can i reenable it??
If you convert the .bat file to an .exe file, then it would be a lot harder to decypher the code and get your password.
to hardhead:
try easy batch file converter for free. It works great for me for converting .bat files to .exe files.
it works
thax
Really useful – thanks!
Excellent information, and in a quite basic way. I quoted your info on my site, and shared it with my visitors. Thanks a lot =).
wow….krenz bagetzz
klu da yg laen ,ajrin lagi donk !!!!
Thank you so much! This post was invaluable!
ps: you all might as well not change the password cause you know thats what your hiding… lol
HI everyone! Here is a modified version of this program.
IT has the following FEATURES:
- LOCK a Folder / LOCK a Folder and hide it.
- UNLOCK a Folder
- UNHIDE a Folder / UNHIDE a folder and UNLOCK it.
- You can lock/unlock a folder of your choice. Just type in the folder name.
- You can UNHIDE a hidden folder of your choice, but you need to know the name of the folder you are going to UNHIDE.
- MENU
Just copy and paste the code below in notepad and save it as filename.bat and then run it. That’s it!
You’re free to copy and modify the code and sell it if you want.
- BRUNO
===========================================
@ECHO OFF
ONELOCK
ONELOCK2
ONEUNLOCK
title LOCKA FOLDA
:MENU
echo **LOCKA FOLDA MENU**
echo L – Lock a folder
echo U – Unlock a folder
echo H – Unhide a hidden folder (Make sure you know the folder name)
echo A – About this program
echo X – Exit
echo Enter your choice:
set/p “chois=>”
if %chois%==L goto BEGINLOCK
if %chois%==l goto BEGINLOCK
if %chois%==U goto UNLOCKF
if %chois%==u goto UNLOCKF
if %chois%==H goto BEGINUNHIDE
if %chois%==h goto BEGINUNHIDE
if %chois%==A goto ABOUT
if %chois%==a goto ABOUT
if %chois%==X goto END
if %chois%==x goto END
:UNLOCKF
cls
echo Please enter the folder you want to UNLOCK:
set/p “lockfldr=>”
:UNLOCKF2
if EXIST %lockfldr%”.{ECF03A32-103D-11d2-854D-006008059367}” goto UNLOCK
if NOT EXIST %lockfldr%”.{ECF03A32-103D-11d2-854D-006008059367}” goto UNLOCKNOTFOUND
:BEGINLOCK
cls
echo Please enter the folder you want to LOCK:
set/p “fldr=>”
if EXIST %fldr% goto LOCK
if NOT EXIST %fldr% goto LOCKNOTFOUND
:BEGINUNHIDE
cls
echo Please enter the folder you want to UNHIDE:
set/p “lockfldr=>”
if EXIST %lockfldr%”.{ECF03A32-103D-11d2-854D-006008059367}” goto UNHIDE
if NOT EXIST %lockfldr% goto END
:LOCK
ren %fldr% %fldr%”.{ECF03A32-103D-11d2-854D-006008059367}”
goto DONELOCK
:UNLOCK
ren %lockfldr%”.{ECF03A32-103D-11d2-854D-006008059367}” %lockfldr%
goto DONEUNLOCK
echo %fldr% has been successfully locked!
echo Would you like to hide this folder?[y/n] :
set/p “chide=>”
if %chide%==Y goto HIDE
if %chide%==y goto HIDE
if %chide%==N goto DONELOCK2
if %chide%==n goto DONELOCK2
echo Would you like to lock another folder?[y/n] :
set/p “dlock=>”
if %dlock%==Y goto BEGINLOCK
if %dlock%==y goto BEGINLOCK
if %dlock%==N goto MENU
if %dlock%==n goto MENU
echo %lockfldr% has been successfully unlocked!
echo Would you like to unlock another folder?[y/n] :
set/p “dlock=>”
if %dlock%==Y goto UNLOCKF
if %dlock%==y goto UNLOCKF
if %dlock%==N goto MENU
if %dlock%==n goto MENU
:UNLOCKNOTFOUND
echo %lockfldr% Folder not found!
echo Would you like to try again?[y/n] :
set/p “unotf=>”
if %unotf%==Y goto UNLOCKF
if %unotf%==y goto UNLOCKF
if %unotf%==N goto MENU
if %unotf%==n goto MENU
:LOCKNOTFOUND
echo %fldr% Folder not found!
echo Would you like to try again?[y/n] :
set/p “notf=>”
if %notf%==Y goto BEGINLOCK
if %notf%==y goto BEGINLOCK
if %notf%==N goto MENU
if %notf%==n goto MENU
:AFTERUNHIDE
echo Would you like to UNLOCK this folder?[y/n] :
set/p “afthide=>”
if %afthide%==Y goto UNLOCKF2
if %afthide%==y goto UNLOCKF2
if %afthide%==N goto MENU
if %afthide%==n goto MENU
:HIDE
attrib +h +s %fldr%”.{ECF03A32-103D-11d2-854D-006008059367}”
echo %fldr% is now hidden! Please take note of the folder name because you will need it to unhide the folder.
goto DONELOCK2
:UNHIDE
attrib -h -s %lockfldr%”.{ECF03A32-103D-11d2-854D-006008059367}”
echo %lockfldr% is now visible!
goto AFTERUNHIDE
:ABOUT
echo +—————–+
echo ¦ LOCKA FOLDA ¦
echo +—————–+
goto MENU
:END
================================================
MABUHAY PINOY!
works well.
but one question,
i have forgotten my password,
what should i do now to retrieve my stuff inside it?
it worked and the folder dissappeared.
but now it doesnt re-appear.
i am using vista and have tried all the faqs but no luck.
plz help asap
PLEASE HELP!!!!
I have the same problem as Harry in his post a few months back. Does anyone have a solution??
Harry
April 29, 2008 at 7:24 am | Permalink
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.
This wont simply work on VISTA.
I tried this and it won’t create a folder.
As someone mentioned, may be its simply hiding itself coz the “hide” is on?
I have Vista and this works (somewhat). It creates the “Locker” folder, and it “Locks” it and hides it from view. But you can’t unlock it. You have to type “(containing folder)\Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” in the address bar to see it.
thanx alot budy
how to hide files and folders using C in LINUX???
I’m using Vista Home Premium 64bit.
In my case, I just want to hide files from being seen by my spouse and kids. I’ve tried a few of the encryption programs and all had 1 flaw: they allowed all profiles to view the hidden and encrypted files via the Windows “search” box…and what good is that? sure, access wasn’t available but you’d still have to answer questions as to file names.
ie: Honey, what is “My wife’s butt.jpg” and why does it ask for a password to view it?
Simple fix:
Open control panel, choose “indexing options”, “advanced” and then “file types”.
From there, unselect the file types you don’t want displayed by Windows search.
Sure, it’s not the perfect solution and it does nothing to stop a determined person from finding that/those pictures or movies by combing through folders, but it stops lazy folk in their tracks.
Cheers!
Darrin
HELP! Does anyone know how to lock/hide a folder with a shortcut to the desktop and still be able to access it without unlocking/unhiding the folder? Can the code here be modified in any way…
I’ve Vista, did this, got the message “Are you sure u want to lock the folder(Y/N)”
I hit y to continue. I attempted to try to open the file but the black box just flashes. I was able to take a screen cap to see what it said:
The system cannot find the batch label specified -
This is the code I’m using minus my password.
cls
@ECHO OFF
title Folder Locker
if EXIST “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” 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-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%==INSERT LOL PASSWORD HERE goto FAIL
attrib -h -s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
ren “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” Locker
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Locker
echo Locker created successfully
goto End
:End
Any help would be much appreciated. I got some files I don’t want to lose.
I think a lot of people have already said this, but it doesn’t work very well on Vista. It creates the locker folder, and it hides it, but when you try to open XYZ.bat again, it just flickers for a millisecond and disappears. However, although the Locker folder no longer appears, the Control Panel.{blahblah} folder appears in the folder tree on the left side, so it’s not really hidden. It’s still a useful trick, though, so thanks for the code.
For the guy who posted right before me, check in the folder tree to the left of the window. I’ll bet there’s a folder called Control Panel.{blahblah} with your stuff. And for future reference, you should test these kinds of things before you use them for important files.