How to create a Password Protected Folder in Windows 7

This tutorial will guide you through the steps required to create a locked folder in Windows 7 – without installing any additional 3rd party software.

9/27/15 Update: although the screenshots will be different, the method outlined in this tutorial to create a password protected folder does work in Windows 8.

While the steps below will guide you in creating a hidden and password protected folder, this method is not 100% secure. It will deter the average computer user enough, but an advanced user will be able to access the contents of this folder. If you want to create a truly secure and encrypted place to store files and folders that absolutely nobody will ever be able to access, see the tutorial How to Securely Store Files in Windows (which includes installing software, but it’s completely free).

  1. Create a new folder and name it whatever you would like.
  2. Open the folder, right-click on a blank area in it, then select New -> Text Document from the pop-up menu.
  3. Open the text file you just created by double-clicking it and copy/paste in the following text:

    title Folder Private
    if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
    if NOT EXIST Private goto MDLOCKER
    echo Are you sure you 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
    ren Private "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
    attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
    echo Folder locked
    goto End
    echo Enter password to unlock folder
    set/p "pass=>"
    if NOT %pass%== PASSWORD_GOES_HERE goto FAIL
    attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
    ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private
    echo Folder Unlocked successfully
    goto End
    echo Invalid password
    goto end
    md Private
    echo Private created successfully
    goto End

  4. In the above code, replace the key PASSWORD_GOES_HERE with the password you want to use to unlock the folder. For example if you want the password to be 123456, the line should look like:

    if NOT %pass%== 123456 goto FAIL

  5. Save your new file in the .bat format with the complete file name being locker.bat. To do this, make sure to change the Save as type: to All Files (*.*).

  6. click to enlarge

  7. In the folder you created back in Step #1, double click the locker.bat file and there will now be a new folder named Private where you can put anything you want.
  8. Upon exiting, double click the locker.bat file again. It will prompt you to answer whether you want to lock your folder or not. Press Y and the private folder will disappear.

  9. click to enlarge

  10. In order to retrieve the Private folder, all you have to do is double click the locker.bat file and enter the password which you set in Step #4 and the folder will appear again for you to access.

  11. click to enlarge

  12. That’s it!

Again, this method is not truly secure. How to Securely Store Files in Windows will take you through the steps to create a really secure folder (using free software).

1,075 thoughts on “How to create a Password Protected Folder in Windows 7”

  1. The first time I ran it it created the folder, but after hiding it it would not bring it back. It gives the message “goto unexpected at this time”

    It also says Quote is not recognized as an internal or external command

  2. Couldn’t you simply click “edit” on the batch file and easily read the password to unlock the folder? Seems pretty ineffective.

    1. @Bill – yes. It’s meant as just a quick way to hide/secure a folder. As I mentioned, it’s not meant to keep any kind of very advanced user from viewing the folder. Opening the batch file in a text editor would reveal the password very quickly :)

  3. I recived “goto unexpected at this time”
    when trying to unlock the folder

    looked at the Code and the line:
    set/p “pass=>”

    has no ASCII quotes in it from the copy and paste
    remove and re added them inside of notepad and everything works as it should.

  4. Pingback: Create A Password-Protected Folder In Windows 7 Sans Software | Lifehacker Australia

  5. Splist – you’re right – there was a formatting issue in that line, which I’ve now fixed. Thanks!!!

    Fabian – I also fixed the rest of the possible ascii issues in that line, try the copy/paste method again. I just tested it in Windows 7 again with a copy/paste and it worked for me (using Notepad to create the .bat file).

  6. hey does it work for vista 32 bit coz i tried but tried to un lock the folder thru locker.bat it creates O named filed with O bytes and nothing happens…

  7. this is great ive been trying to figure a way liek this for very long now and i used the transparent icon tut on lifehacker to make the icon of the folder private is in and put it on my desktop so it looks like nothing is there aswell!

  8. I tried this on my vista 64 bit and it worked perfectly! Also if you don’t want someone to open the batch file and find out the password just move the batch file into the password secured file afterward.

  9. it is not work..some error is coming that the system cannot open the file MDLOCKER..
    so wat can i do….. is there any trick for that same……

  10. Anyone may simply delete your locker.bat file, create a new one with a new password and access your data… This is not very safe to me :)

  11. Pingback: Windows7truuks « Windows 7 naar uw smaak

  12. I (foolishly) deleted the folder to start over. Now, it doesn’t work and I need to uninstall and start over. How do I uninstall??

  13. Oops, sorry my post was missent earlier. I meant to say:
    ‘Office 2010 will not allow saving the .bat as ‘all files’. The option does not appear. I saved as .doc and of course failed to achieve anything. Any suggestions? I am in W7 Enterprise.’

  14. Pingback: Windows 7: Proteger carpeta con contraseña

  15. Pingback: Membuat Folder Rahasia di Windows 7 | KomputerBLOG.Com

  16. Pingback: Membuat Folder Rahasia di Windows 7 « JONO NEUTRON

  17. Pingback: iWant Blog » How To Create A Password Protected Folder In Windows 7

  18. Pingback: Password-Protect a Folder in Windows 7 Without Downloading Anything | Computer Booster

  19. Pingback: Microsoft Links « Frackmente

  20. This is excellent! Thankyou so much!
    I’m used to having a protected folder cause my old laptop had a program called My Safe that was locked by finger scanning… but my new computer doesn’t so this will have to do lol.

  21. Can I move this bat file to where ever I want now? Can’t someone just rightclick+edit the bat file using notepad to see the password if it’s sitting around?

  22. Also, if the .bat is deleted when the folder is “hidden” where does it actually go, and will I be able to access it should the .bat be deleted? How do you remove the password protection if one decides he has no need for it anymore? Just delete it?

  23. CodeBreaker:
    Yeah.. here’s where your file hiding.
    C:\Users\DUDE\Desktop\Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}

  24. Thank you SO MUCH! This is extremely useful, everybody else just told me to encrypt it or something but this is exactly what I wanted! T’anks!

  25. Pingback: Membuat Folder Rahasia Dengan Password di Windows 7 | Portal Informasi dan Download Gratis!

  26. Here’s a nice little tip I tested. Probably won’t make it too more secure but it will throw some people off. Change the found to wingdings and they can’t read it. So your password can’t be seen.

  27. What if the folder you want to make private is entitled something like “ZH Pics”? How do you deal with space?

  28. Thank you very much… This is exactly what I wanted, just to hide few folders from my pals.
    After hiding, I just compressed the locker batch file with a password and deleted the original batch file.

  29. Pingback: How to create a Password Protected Folder in Windows 7 – Simple Help « Aero Digital Life

  30. Pingback: Create a Simple Password Protected Folder in Windows 7 Sans Software « kh4it

  31. Hey when you click once the locker icon the command including your password shows in the details (preview) window.. is there a way to hide it or else it’s not protected at all hehe!! :)

  32. Pingback: vista folder ???? - PCMech Forums

  33. Is there a way to put the bat file in on spot, say music and have the folder in another spot say pictures for example? I would really like to hide the bat file, and have the folder appear somewhere else.

  34. 1. What will be if you delete the locker?
    2. What will be if you rename that “private” folder into another name?
    3. How advanced users can bypass this method and view the contents of the folder?
    4. I have 2 OS on my PC – Windows 7 and Windows XP. If someone would restart PC to Windows XP, will they eventually see the folder? Or will there still be the locker and the system will work?
    5. What if I have this folder in external HDD? And if this HDD will be carried to another computer and connected there. Will the locker will work? Or the contents will be simply accessible?

  35. Great work!

    I guess to enhance the “SECURITY” more, we just need to put the “locker.bat” in a .rar file and encrypt it with a password too. Damn Hassle, but i guess it somehow helps? LOL

  36. Hello,
    this method of folder protection has worked nicely. thank u, but how to change the password in case of requirement, because when i tried to open the content of the notepad file to change the password, the content itself was not appeared. plz help me any body..

  37. This method is surely for noobs. Any human that has a little bit of knowledge, is smart, can bypass this. So it is not safe. But I’m glad to know it. However the whole system must be upgraded in order not to bypass this so fast.
    Best way is to zip your folder and set a password.

  38. One problem I saw with this.

    If you have the sidebar preview active, when you single click on the locker file, it shows the contents (i.e. the code) that has the password written into it. If one were to read the code, they could easily find out your password.

    Any way to fix this?

  39. L’unica cosa che non mi piace realmente di questo bel programma è che quando si inserisce la password, la stessa è VISIBILEa chi ci stà intorno; non è possibile criptarla con ****** ?

    Potete dirmi come si può aggiungere questa variazione al programma ?


  40. Pingback: Membuat Folder Rahasia di Windows 7 « Berita Exist

  41. This is nice, but how will you be able to hide the actual locker.bat file from being seen then? Cause once you right-click then edit the bat file, you can just easily see what’s inside the file itself…

  42. I am glad to know it . But simply right click on the locker file and click open , you will see the code there which has the password. Not safe method.

  43. i m not able to retrieve my private folder.. i m entering my password correctly.. but its not retrieving.. what should i do now… tell me plzzz…!!

  44. Its simply superb. however if anybody right click and edit the locker.bat file they can easily view the password. I think its not completely SAFE…

  45. is it working ? It seems like working but it is simply hiding…………when search hidden folder your private files will be open or if you go to recent documents it will give direct access to your private folders…………

    If any body had any solution plz inform…………….

  46. excuse me, but once you have opened the file, you can’t lock it back again… can anyone tell me how to do that please.

  47. That’s cool and all, but it does not work when you have the option “show hidden files” on. But this is a rather clever trick, good sir.

  48. Pingback: Burhan Ahmed » Create a Password Protected Folder in Windows 7

  49. I am having a problem..can anyone help? i made the folder where the password is written ut as i double lcik t ”main folder” i dont get any folder named”private”

  50. It has nothing to do with a password protected folder, its just hidding your folder and makes it look like a system folder.
    On folder options; selecting “show hidden file” and removing the check mark from “hide protected operating system files” it will be visible to all,
    better if you create this “hidden folder” to a specific path where nobody would see them deep in the system (if it is very important not to be detected from anyone)

  51. This worked great for me!!. The only problem I had at first was when saving the text doc I had no option to save ALL FILES, which I found was because I did this wordpad NOT notepad.. But once I did this in notepad It worked exactly as described.. For some reason which Im not sure why (wanna be nerd) when I right clicked to create the new textdoc mine opened it in word pad. But while rereading I seen it was in notepad, I tried again just slightly different path (not by much) all was well.. Thanks for the info!

  52. thank u, thank u, thank u, it realy worked but i have a question does it work on other windows such as XP or others???

  53. It really works but its just going to hide. the folder… and no use for the password thing…
    hope you can make more security about the script…


  54. Thanks bro for this article, also it’s a useful method….
    BUT the problem is anybody can go the “locker.bat” and open it as editing, then the password would be clear to see; so this method is not 100% secured.

    If any other method could be used, please provide us with it.
    Thanx again :)

  55. for the password problem, set the password to any number of these: *
    mine is this: ********* so anyone who edits it think its hidden, tho that is the actual password! ;)
    just an idea x

  56. Very useful batch file script. Can you change name of the folder from Private to another name, by editting the script & replacing Private with another name

  57. ALWAYS! Always! always!
    It is awesome and It works :) :)
    But the problem is if u delete the file locker.bat
    It can be searched

  58. It isn’t really that secure. If you go to you start menu icon and use the search engine to find the folder you have set as private. You will be able to find the folder and let’s say if anybody know’s the files name, it can totally be viewed without having to enter any password’s. All that this does is hide’s the folder but not permanently locks it. So its a good thing if no one know’s the name of your file :P

  59. Very good idea BUT if someone searches the file make in the private folder they can access it anyway from searching in the start button… just letting everyone know this isn’t a fool proof lock at all!!

  60. this is not good way because if we un check Hide pretected operating system file in folder option every body can see this file!

  61. sadly not work the item that you but it in the protected folder simply wil be showing up in the search bar : ( just try

  62. The thing is, If you right click the “Locker.bat” and you choose edit,
    The password will show up in this text: if NOT %pass%== PASS_GOES_HERE goto FAIL.
    So thats a problem, the problem, everybody can figure that out. There should be a lock on that aswell. And does anybody know how to get a censor “******” when you type in the password? So when friends are looking they won’t be able to see the password. Please comment on this reply.

  63. Pingback: How To Create A Password Protected Folder In Windows 7 | EM Logo

  64. Maulik C. Goswami

    can we hide password while typing it.

    like can we have ” **** ” instead of visible password

  65. Sharon Satterwhite

    This method is not secure at all. I did a search (in Windows 7) for the files I put in the “Private” folder, with the lock ON, and they came up in the search pane.. I double clicked on the “locked” files and they opened right up. To make sure they were locked, I went to the folder I created, double clicked on the locker.bat folder, and the box popped up, asking for my password. Apparently, the search feature completely bypasses the password process. There must be a better way to lock a file. I have a password on an individual file, but that can be cracked, too, by anyone with a little advance expertise..

  66. Just rename batch file to sth like “Windows Driver 146s987su” and no one will try to access it xD and put it in a folder called ” Windows Drivers for /&&#)%I/%” and SUCCESS !

  67. @SHARRON Yes, like mmtg96 said, name it some random combination of letters and numbers. No one will search for it. If you don’t want to do that, you may have to go with third party software. I don’t know much about it.

    Anyway, thanks for this tutorial! It’s great.

  68. bat files are editable,any body could easily crack it by opening it notepad and change the password,so think a better idea.

  69. Just put the locker.bat folder somewhere weird, and also name it strange, and it will be very hard to search and find.

  70. wow!!! this has been really helpful…but we have to lock it every time we use it….makes it uncomfortable

  71. THis worked perfectly—except for one thing. You can still open the file. if you search it, like someone else mentioned, you can open it easily. however this is no biggie because no one know what the file is called. the real issue is that when i right click on the wordpad icon on the bottom bar of my screen, it shows all the documents ive worked on lately, and anyone can see the file and click on it. HELP!!

  72. I am downloaded file loker from all the site and it dosen’t work.
    Finally i click on this site and i try its really work .
    Thank you………………………….

  73. thank uuuuuuuuuuuuuuuuuuuuuuuuu soooooooooooooooooooooooooooooo muchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

  74. hey its amazing
    ???? when i am search jpg or any type of file then this private folder shows any items????????
    so thanks……………………………..

  75. Works perfect for what I need — a way to deter the random morons who might go poking around if I leave my laptop unattended. In my case, they don’t know what they’re looking for and they’re not tech-savvy enough to realize what the locker.bat file might be. And if they were suspicious and opened it, they would get the password prompt and back away. The other commenters are right — this is not something you would want to use when you’re dealing with a person who 1) Knows what to look for, 2) Knows how to edit .bat files. Think of it as a deterrent, not a full-on security measure. Thanks for sharing!

  76. If you right click on locker.bat and press edit, you can see everything you printed in text file including your password, so it is not safe to use your password on this program that you are using somewhere else.

  77. and unless some one knows what they are looking for in the search engine they won’t find it , no one knows what files i have hidden or their names simply because i have never told them they exist, so unless someone knows what to look for the won’t find it .

  78. i did the above…locked the folder…but in windows search panel when i enter the folder name it shows the private folder and contents automatically without password…check it

  79. Hello Guys, If you’ve been doing this and had succes, there is more! I’ve extended my “private folder” a little bit, I’m gonna post it, edit the “TITLE”, “PASSWORD”, “NAME.”
    Please give feedback!

    title Willem’s Business
    FOR /F “tokens=*” %%A IN (‘DATE/T’) DO FOR %%B IN (%%A) DO SET Today=%%B
    ECHO DATE: %Today%.
    FOR /F %%A IN (‘TIME/T’) DO SET Now=%%A
    ECHO TIME: %Now%.
    if EXIST “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” goto UNLOCK
    if NOT EXIST Private goto MDLOCKER
    echo Are you sure you 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
    ren Private “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
    attrib +h +s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
    echo Folder locked
    goto End
    echo Enter your name. (Real name)
    set/p “name=>”
    if NOT ‘%name%’ == ‘Willem’ goto failz
    if NOT ‘%name%’ == ‘Willem’ goto failz
    if ‘%name%’ == ‘willem’ goto awesome
    if ‘%name%’ == ‘Willem’ goto awesome
    echo Access Denied.
    echo Access Granted.
    COLOR 7
    echo Now please enter password.
    set/p “pass=>”
    if NOT %pass%== superman goto FAIL
    attrib -h -s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
    ren “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” Private
    echo Folder Unlocked successfully
    goto End
    echo Invalid password, You have 1 try left.
    echo Type in password correctly, or computer will proceed shutdown.
    set/p “pass=>”
    if NOT %pass%== superman goto FAIL
    shutdown -s -t 10 -c “Access Denied. Windows is shutting down.”

  80. This method is good for computer noobs.

    To find the password, all you have to do is right click the .bat file and open with notepad, then you can see the password.

    Truecrypt is the best free solution

  81. Hey Buddy…
    It is gr8…but one bug is their….any one can see batch file & will get password easily

  82. I did this and now when i left click on the locker (.bat file) it will flicker on the screen and not allow me time to input anything. Or, it will open a new Private folder that has NOTHING in it and that is what i have unlocked. Helpppp!! Lots of irreplaceable pictures in this folder! and im not computer literate enough to find them!!

  83. Hey, one idea on where to put the file so that the search bar wont bypass the locked aspect is to put it inside of the Appdata folder.

  84. If I put a notepad text document in the private folder and have it passworded, what is the point if someone can just go to start and see the latest notepad text document and pull it up without a password?

  85. whats the point of making this private folder (I’ve done it) if the notepad text files can still be accessed without passwords as a document?

  86. if some one deletes the locker file, then how to get back the files from the Privat folder of the locker file.

  87. the only thing that is wierd to me, it dont matter if i type the right password or a false password the folder “private” comes up no matter what.

    lets say my password is: 123456
    & i type in 123 in the password it still opens the folder, or if i type hagasdg or anything i type opens the folder…

  88. i had the same problem Daniel… edit the file and after == type your password without leaving a space….==123456 and not == 123456…

  89. its good. but if we search file name of the file in private folder it will be found.and right clicking “open file location” opens that folder.. any solution for this?

  90. Then…does this mean anyone could just open up the file if they really searched for the pass?
    Since you can edit the text document’s/locker’s information, if someone went to edit it they could find the pass out by looking through the text…right? If the pass can easily be changed like that then I’m screwed if my parents open these files. (Yes, they are skilled with computers and such)

    But I’ll just hope they don’t go snooping around on my computer. Thanks for the information though. At least my little sisters and bother wouldn’t be able to figure that out I don’t think.

  91. Kwstas, actually it’s there has to be a space between both the “==” and the “goto”. I’ve tested it both with spaces and without. W/o spaces, I could type in anything and the folder would pop up. With spaces, if I typed in anything, nothing happened.

    But it’s still is easy for anyone to edit the file if they know at least the basics…good thing there are VERY few people I know that are actually computer smart or could at least think to click “edit” or even bother to try to search up how to open it.

  92. Maho13 at first i put a space but whatever i typed the folder appeared and when i left a space after “==” worked fine…
    but at least in my family there is no person who will think to right click the whole family apart from my brother are not computer smart but even my brother when he will see the locker he won’t think that is an editable file…
    It would be great if you could set and another password with the ability to delete, encrypt or hide all of the files inside the private folder…so if somebody don’t believe that you have nothing inside the folder and force you to open it you can prove them that there isn’t anything inside..but i am not so computer smart and i don’t know if this is achievable…

  93. It’s a very good batch. Make sure that you get it running first, and then password protect it using winzip or any other zip utility, if you don’t want anyone else to use or edit it, here’s for: Right-click on the batch file and click on “Winzip”, scroll down and click on “Add to Zip file”. Check “Encrypt added files”, click on Add, enter a password in the pop-up window, repeat the password, Click on OK.
    This way, you’ll be the only one who will able to run or edit the batch file.

  94. when i lock the file the “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” file appers and i clicked it and all the things that i want to protect is… well… unprotected.. tell me what i did wrong.

    1. No Rita .. it wont .. the folder and the Locker.bat  will be in the recycle bin.. BUT if u delete the locker.bat from the recycle bin .. every thing in the folder will be lost !!.

      Syed .

  95. Best practice is to always keep a backup copy of the file. Always backup your data, folders and files…. Backup, Backup, Backup… Keep a copy of that files in different places..

  96. i did it but the folder did not disappear completely just changing it’s name ,and i have access to it!

  97. BUULLSHHHIT, its just makes folder renamed and hidden, nothing usefull – at all,
    Hey people search for smth else!

  98. Sorry it was great…but if a noob puts Doc view on and then clicks on the file he can see the password…so great if i wana keep a noob out, but hate to say it a 5 year old now days can figure out more shit about pc’s just cuz of how tech has advanced.. 

  99. Hello,
    That’s cool but I got a little problem. I followed the steps, stored the data in this Private folder and now when I click locker.bat file, it just flashes i.e. I can’t see my data in this Private folder. Please help.

  100. sad. by enabling the option in the “folder options” that shows the file extensions, you can see the .bat extension in the locker.bat file. then you can change that extension to .txt and you can already see the password. =(

    1. Dear Guest –

      This is absolutely true. With that said, it is mentioned up front at the beginning of this tutorial that this method for creating a password protected folder is not 100% sure, and is intended to hide files from the casual observer. You can use software like TrueCrypt to create a truly secure password protected folder, but that involves downloading, installing and setting up TrueCrypt. See: for more details (although that’s a fairly old tutorial and is probably out of date, it will give you an overview and very good idea of what’s involved in using TrueCrypt).


  101. By enabling ‘show hidden files’  i can open the private folder without any password, only the folder name changes from private to something else when hidden.

  102. the password already written in the locker.bat file. Everybody can open it and read the password, and then run the file. Is there any other way to protect our folders?

  103. It just renames the folder to some operating system folder e.g. Control Panel… & it becomes invisible… if u will uncheck the option from the Tools -> Options -> View-> ‘Hide protected operating system files’ and also check the radio button – ‘Show Hidden Files’ then u will see the folder renamed like – ‘Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}’… numbers can be different… this is yr folder…

  104. its like nothing, script dose only hide the folder by password.
    1) Run folder options- 2) view tab 3)show hidden files, folders, and drivers, then ok
    folder will be visible, you can deleted without the password. please trying to do something else, thanks anyway  

    1. you right …
      after showing the hidding files and folders ,, file name will be
      Control Panel.[xxxxxxxxxxxxxxxxxxxxxxx]

      xxxxxxxxxxxxxxxxx = numbers and char .

  105. i did this but.. all those files i added to private folder are deleted now.. and even the password is not working :(

  106. ooooooowwww. it takes me weeks to browse my computer just to find a locker. now i got it. thanks much buddy.

  107. This might be all well and good, i was going to use this to safely hide personal customer files as i am a Data Protector but there is a flaw in the program.. If you right click the bat. file and click edit, it takes you to the script you created and reveals your password!! Not great

    1. for this you could do one thing
      1st follow all d above instructions
      then hide your folder and remember the location of your folder
      lastly just move this “locker.bat” file in any folder you like

      if any one finds out “locker.bat” n click on it only a new “private” folder will appear
      but your original folder is safe in its location
      and to get your folder back all you have to do is move “locker.bat” in the actual folder where your original “private” folder is

      1. or you can name it as something only you know and delete the file after locking. when you need to open the folder create a new lock file with the name you had given and any password of your choice. It still works .

    2. Or you can make the .bat file a “un-editable” object. Look at the properties of the file , under the security tab and check “Modify” as deny. This will make it un editable even for you unless you make yet another “higher” level admin or what not.

  108. it’s a good idea to rename the locker file to other names like bin , rec ,res that the other advanced user may get cofused

  109. I did this eventually deleted the locked folder… then later a subfolder that i had previously moved from the locked folder will not let me modify or delete its contents because it is still somehow locked. I “need permission from computer1:Username” how can i fix this?

  110. this are all piece of shit I try to search how to completely hide folder,, but this is shit,, if you try to go to search bar and type sex, porn, virgin things like that it still comes out even you put it in the private and you lock it,,,

  111. fuck off this fucking thing dosent work, it only works if hidden files and folder is in show mode and every one knows how to show hidden files and folders asshole…….

  112. there is still one more problem though
    the files in the folder show up in search
    and if anyone knows the name or the type of any file then they can get access to the folder easily
    so can something be done about it??

  113. apart from others findind your password there is one more problem
    and that is that your files can be searched using the search option

    for that just encrypt your folder
    and deny all the permissions to users and system

  114. Pingback: How to create a Password Protected Folder in Windows 7 — Simple Help « Alucardv's Blog

  115. there’s another flaw with this: if you search (via start menu) the name of a file that’s in your private folder, it shows up and you can click on it there and see it… it won’t ask for the password

  116. Yes it works…. BUT, Anyone can just Right Click Then click edit. Change The password
    or look at it. Then they can access it!

    1. I went into the .bat and renamed the “Please enter password” to “Please Exit Now” so only you know to type in a password ;)

  117. private folder goes of but instead a folder named control panel s coming thro which i can open those folders it doesnt asks me for password

  118. it is not a password protected folder cuz anyone can right click the “locker.bat” click edit and change the password

  119. Not safe….. I just done folder hidden
    If show hidden files option is on ….. it shows as hidden folder…. double clicking it opens the folder
    is there any other way

    1. the script sets the folder as a protected OS folder. The folder will remain hidden with “Show hidden files, folders” turned on. But it will be visible and accessible if “Hide protected operating system files” is unchecked.
      Unless your hiding something from a fairly advanced user and know they are looking for a hidden OS protected file just keep Hide protected Checked and it will do its job.

  120. this is good…but i dont like it that much.

    1.cant change the name of the folder

    2. i dont want to hide it just add a password

    i just want to encrypt some movies and tv shows which are violent and has nudity in it so that none of my family members or small kids come in contact with it ..well for me this doesnt help ..sorry!!

  121. i just want to add password to some violent and offensice movies and tv shows so that my family and smalls kids dont get in contact with it..this is not so good though as i cant change the name of the folder i am shows “PRIVATE” i dont want it to show PRIVATE name i want it to show the name of the offensive material !

    1. To rename the folder open the .bat file in notepad (right click -> Edit). in notepad press Ctrl+H to bring up the replace feature. in Find What type “Private” without “” and in Replace with type your desired folder name. Hit replace all and save the .bat. it should now create the folder with the name you chose

  122. For those worried about how easy it is to view the password. Download a free .Bat to EXE converter. A good converter like “Advanced BAT to EXE Converter” will encrypt the data so even if the .exe is renamed to .txt the source info cannot be read.

  123. I gone every step and just simply doesn’t work I belive there should be two places to enter password, but these coading has only one password place to type.

  124. hi there…for those who say that you can right click it and edit they can put it in archive with a password….moreover they can hide all the files inside the private folder….

    but i want to know if there is a way to do it to an external hard disk…is there a system file that i can move to the disk an make it work? because it works only in the computer that i made it…anyone who can help..??


  126. How can asterix (*) can be wriiten in prograaming so that while typping password in the DOS , it is not shown to the users but shown as ****** .

  127. I did this and I put in a password then tried to use anything to sign on to the file. If the password was 1234. All I would have to do, to see the file that has been locked, is put 1 or 2 or 3 or 4. I wouldn’t have to put all the password in. Just a number that was in the password.

  128. if you wants to go for the extra mile after you have hide and lock the folder you can just move the bat file away so only you know the actual location and also this will protect you from the issue mentioned below and that wasnt the only issue with this. if you know the exact location of the folder all you have to do is go there and create a new bat file with a desired password and you can unlock the folder thats the only reason i said you should lock it and then hide the locker file some where else so its a little bit more protected

    1. if you move the bat file and some one click it wont do anything but create a new folder called private in that location your original stuff will stay hidden till you take another bat file where you wants to and open it. i had to hide my past papers in my laptop due to the campus policy of having pass papers is punishable by expulsion. even the it department couldn’t find the stuff hidden cuz i put the bat file some where else. they did broke the bat file encryption but there is nothing to be found unless you know where exactly to look

  129. hey i have gone through the above method but when i retrieve private folder, it shows empty folder i could not find data now please help me

  130. i accidentally deleted the folder and locker can u help me to restore it coz i cant see the files on recycle bin, please help me

  131. PLEASE HELP!!!! Do you know what do to if you forgot the password and can’t find the “locker.bat” file? PLEASE HELP!!!!

  132. Is there a way to make the password hidden and show up as * for example if the password were Password it would show up as ********

  133. it is good but i have some problem in this case .i.e bat file is deleted so how to get the my folders please give me suggestion

  134. This code,because the original said that the Control Panel file didn’t exist for me,will allow you to Lock with Y, End with N,and Unlock with T. Just like the original,replace PASSWORD_HERE with you password.

    title Folder Private
    echo Are you sure you 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
    if %cho%==T goto UNLOCK
    if %cho%==t goto UNLOCK
    echo Invalid choice.
    goto CONFIRM
    ren Private “Private”
    attrib +h +s “Private”
    echo Folder locked
    goto End
    echo Enter password to unlock folder
    set/p “pass=>”
    if NOT %pass%== PASSWORD_HERE goto FAIL
    attrib -h -s “Private”
    ren “Private” Private
    echo Folder Unlocked successfully
    goto End
    echo Invalid password
    goto end
    md Private
    echo Private created successfully
    goto End

  135. I want to delete the locker bat and private file but my computer won’t send all the files to the recycle bin. The few files it does send cannot be emptied from the recycle bin afterwards. How do I get rid of all files, the locker. bat and the private folder from my computer?!

  136. haha it was good , but if you leave the password like 123456, and if you try to unlock with any number you can unlock 654321 5256325 52425 what you want to write that will be unlock, doesnt good work .

  137. i follow the instruction but i can’t do that.
    do you have more ideas on how to protect my files in a folder?…help..

  138. This method does not work for me. I created the locker.bat file as instructed. When I double-click it, a cmd screen flashes very fast, but I can see that it says “Private Created Successfully”. However, the Private folder is never created. If I right-click on locker.bat and run as administrator over and over, the script seems to be functioning in that it allows me to lock and unlock the “folder”, which does not exist.
    Can someone please let me know what is missing? I’m running Windows 7 – 64.

  139. It is good, but user can see the folder and nested files if he types in search bar.
    Then what could the solution for this.

  140. this method did not do anything.
    i opened my folder and the private folder but none of them asked for a password

  141. First, thank you, it may not be fool-proof, but it is simple and effective, just in case someone opens my “hidden in plain sight” folder, but can you chain this to have different passwords in different folders that are in the original pw protected folder?

    1. Can hide the file from yourself in security change permissions when you want to use This is only basic for people with limited compknowledge to be able to not just simply double click to find something you dont want them to

  142. hey Startkala2011…need not go that far……………just say dir /ah and you will get that folder listed and say “attrib -r -a -s -h” and your folder is unlocked……………..

    this is not folder security. this is cmdline security..that’s it.

  143. Hi. Very long procedure and you must remember all step as well as the bat file detail. but its work so not bad.

  144. This works perfectly for Network security. All you have to do is severely limit access to the .bat file with the security settings and it’s a very effective tool for keeping department document’s secure on the fly… of course the group security policy is more thorough… but if you just want to lock out one document temporarily this is very handy. Thank you!

  145. I need a help, when i open my bat file with the right password, command prompt it just don’t get’s open the locker and ask again and again for password even though i am giving a right password. how to get my data back ? tq

  146. Jared Hoiting

    Looks like a hoax. I tried this method. When “protected”, the folder only gets the status of hidden file. Everyone can set the computer to show hidden files. Click on the hidden file, no password is asked, and the content is shown. This is not as advertised.

  147. This didn’t work for me. I followed all of the instructions above but then when I opened the folder, no password was requested! Fail.

  148. Jennifer L Carter

    This doesn’t work … it worked at first but after I locked it again the folder will not open again … now my files are stuck in there :(

  149. what is the best way to make it so you cant view or edit the locker.bat file. If someone has reasonable coding knowledge they can view and find the line in the code with your password which is unencrypted

  150. This is not a safe method to lock the folder as when i opened the history of my computer there was a content of all opened files from locked folder and when i clicked one of the file from history of my computer it opened without requiring any password.

  151. thanks a lot. this worked well enough for me. I don’t think that people will try to open the locker.bat file for no reason so the hidden file would be safe enough.

  152. Worked when I set it up and I’ve tried it half a dozen times and always works as described. So a great idea for which much thanks. (And to those who say it can be cracked – yes of course but it’s not intended to defend information against determined & tech-savvy attackers; just to keep stuff from prying eyes; which it seems to do verty well.)

  153. the folder is not locked.. its just hidden with the System and Hidden attributes ;( i thought u had a real password for the folder but it looks like i was wrong lol

    maybe u could create an vbs script with some move and a real LOCKING engine by entering some values on the windows’s registry but let these people be happy with the illusion of a secure folder =D

    i think more than 90% dunno that for just typing on cmd: ” dir /ah ” on the folder will show up this folder and then.. someone will be able to access the folder =o

  154. let me say a tip for a good update of this batch file: change the file name to ” ” (alt+0160 its a blank space, not “space” but its a space lol) and change the location of this folder and then change the icon for a blank icon (may require a vbs script for detecting the OS. if it is a different OS then the icon index may be different) bla bla bla i think u got it

  155. have anybody tried to type a wrong password? cause even if i typed the wrong password still the private folder shows up and all the subfolders too and have the full access.

  156. I put the password in and i gained access the first time but every other time i access the folder it just opens without the need to enter the password again.

  157. If I just right click on the .bat document and click “edit” I can see the actual code, including the password I put in. Is there any way to make this more secure?

    1. BatchBeginner

      Haha yeah, it isn’t very secure in my opinion. Anyone that knows batch can see the password. What I did was I made it create the “private” folder in another location, so it’s harder to be seen.
      But I dont know what you can do to make it 100% secure, maybe ask batch experts.

  158. BatchBeginner

    It worked for a few weeks, but i went there this morning, unlocked the file successfully, and tried to lock it back after im finished with my work. But it says:
    The process cannot access the file because it is being used by another process.
    File not found – Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}

    pls help.

  159. Who made it, I just want to know that great man Identity. Really Awesome. THANK YOU SO MUCH. …:)

  160. When I created a locker.bat file and double clicked it. It simply pompt the cmd widow for password. No private folder is created.
    Please help

    1. You need to make sure it is directed to “all files” when saving, and before you save the code at all make sure you delete “PASSWORD_GOES_HERE” and put your ideal password in its place.

  161. hello, I forgot the password that i have created. want to retreive that folder its very important, so can any one please help

    1. Open notepad, drag the batch file (the one created in the tutorial) into the notepad windows. Then, where you typed your password to set it, you should be able to read it

  162. This display the PASSWORD of which I don’t want a password to be shown,

    The message says enter the password…………..which is my password.

    I want to hid the password?

    please assist

  163. When I lock mine creates a new folder that is called Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D} and you can go to that to open all the files.

  164. This works exacly as described…ONLY ONE MAJOR PROBLEM. After i created the file and was pleased it worked–for the heck of it I did a “search” for the files that were in my newly created “private” folder…to my surprise the supposedly locked files could be viewed (and opened) from there. Any advice on how to slove that?

  165. I have lost all of my files now? Please HELP! I have done everything as described but now when i click the Private file nothing appears!

  166. A nice little solution for the batch file is to set it as hidden but save the location into an unnamed text file then just copy into Run which then access’ it without anybody being able to see the actual batch file and it’s programing!

  167. Is there a way to name this something else besides Private?

    If I try to rename it it just creates another Private folder and not the renamed folder.

    1. In the coding change all the parts that say Private to the name of your choice. Just try not to delete anything other then the words Private

  168. but what is the use of this batch file as and when you click on the file it shows the code, you have to click on hide the preview pane. you will get the complete code with the password!!!!!!!!!!!!!!

  169. That’s awesome but with the one drawback , “password known” in the code .
    I would like to give a solution to it by suggesting you’ll to save the text document containing the code in someother folder so that password cannot be hacked
    I did not try it… This is just a suggestion

    1. Hello everyone I think I have a good idea of getting rid of this password security problem in protected document storage. The literal idea is to cut and paste the document containing code within the private folder itself with the password hidden in your smart phone memo…. :-O:-)

  170. This is only really good to use if you’re just trying to keep curious people out of your stuff. It’ll keep most people out of your stuff, but occasionally people might take the time to open up the batch file and get the password, so it isn’t suitable for private company documents and the such. In that case you would be better off using a third-party program or an encryption service.

  171. Swisten Harsh

    if any person delete this *.bat file so how can it possible archive our data inside the private folder

  172. Muhammad Awais

    it has faults if you search for the things in the start menu that you have kept in the locker they will show up despite being locked up

  173. I don't understand

    It locks up only once. When I access it and then try to lock it again, it just creates another Private folder. How do I solve this problem?

  174. When I try this it creates a folder named “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” when I lock the “private” folder and when opened it contains the files that were placed in the “private” folder. Can anyone help?

    1. you have to double-click the locker.bat again, there’s a prompt says “are you blablabla” type Y then ENTER. That’s it.

      1. i am also having tha same problem i.e (after locking the folder the private folder has changed the name to control panel.{21Ec……….}.wat to do?

    1. Right-click the locker.bat folder and click Edit. You’ll see your password. All you got to do is change the password and click Save

  175. I keyed in my password but it still says password invalid and it doesn’t open up my folder! How can i correct this and retrieve my folder and files again? :(

  176. thanks. it worked. to users who does not work, i think you forgot to change the file format save, look at the pic5 bottom. And you may success.

  177. It works but, If you go to start and search for that folder or a specific file in that folder it still opens it. e- e

    1. Its actually very easy to hack because of how easy it is. Right click the .bat file and then click Edit. Find the line with your password on it and there you go.

  178. Pingback: How to create a Password Protected Folder in Windows 7 « Information Technology

  179. this is not useful..!! if somebody deletes the folder or the locker then, how could i view my files inside the folder or the locker?

  180. Anna