How To Password Protect a Folder in Windows 10

  • MORE

password 18 click enter

We all have computer files we'd like to keep secret from the world. Fortunately, in Windows 10, you can tuck those unmentionable plans or files in a secret folder that is password protected, and you can do it without buying any additional software. 

Here's how to create a folder that you can fill with files you want to keep secret, lock it, open it and repeat.

How To Lock a Folder With a Password in Windows 10

1. Right-click inside the folder where the files you want to protect are located. The folder you want to hide can even be on your desktop.

password 01 find folder

MORE: How to Change Your Password in Windows 10

2. Select "New" from the contextual menu. 

password 02 right click

3. Click on "Text Document."

password 03 select new

4. Hit Enter. It doesn't matter what the file will be named. You can delete this text file once the lockable folder has been made.

password 04 hit enter

5. Double-click the text file to open it.

password 05 double click

6. Paste the below text into the new document:

password 06 paste



title Folder Locker

if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK



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.



ren Locker "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%==Your-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


echo Invalid password

goto end


md Locker

echo Locker created successfully

goto End


7. Find where it says "Your-Password-Here" in the document.

password 07 find yph

 8. Replace "Your-Password-Here" with the password you want to lock the folder with.

password 07b replace with pass

9. Click File.

password 08 replace with pass

10. "Select Save As..."

password 09 save as 2755011437675936

11. Click on the "Text Documents (*.txt)" menu bar that's next to "Save as type:"

password 10 select text documents

12. Select "All Files"password 11 select all files

13. Change the file name to "FolderLocker.bat"password 12 rename to folderlocker

14. Click "Save."

password 122 save

15. Double-click FolderLocker.password 13 doubleclick folderlocker

The Locker folder has been generated!

password 14 fill your locker

16. Fill the Locker folder with the items you want to protect.

password 15 fill your locker2

17. Open the FolderLocker file, because it's time to lock that folder up!

password 16 doubleclick folderlocker

18. Type "Y" into the screen.password 17 type y19. Click Enter, and the Folder Locker window will disappear, along with the Locker folder itself! Your secrets are safe!

password 18 click enter

To unlock the folder, double-click "FolderLocker" to open it.password 19 double click folderlocker

Enter the password you entered in Step 8, and click Enter.

password 20 enter password

password 21 click enter

The Locker folder is back. You can open it to find your hidden files. Repeat Steps 17, 18 and 19 to lock the folder again.

password 22 lockers back

password 23 along with your secrets 2755011437677439

Author Bio
Henry T. Casey
Henry T. Casey,
After graduating from Bard College a B.A. in Literature, Henry T. Casey worked in publishing and product development at Rizzoli and The Metropolitan Museum of Art, respectively. Henry joined Tom's Guide and LAPTOP having written for The Content Strategist, Tech Radar and Patek Philippe International Magazine. He divides his free time between going to live concerts, listening to too many podcasts, and mastering his cold brew coffee process. Content rules everything around him.
Henry T. Casey, on
Add a comment
  • don0833 Says:

    not working for me. when i lock the folder, the locker folder will change its name to control panel and can still be open.

  • ShadySal Says:

    You can edit the bat file with any text editor and change the password even while its "locked" so anyone can open it and see your password or edit it.

    So do not keep the bat file in the same location only when you want to lock or unlock just like a key.

  • Quang Says:

    You can just delete the FolderLocker file, or put it somewhere else.
    You only need it to be in the folder when you want to lock or unlock.
    As long as you remember the same password, you can always make that file anytime following Henry's instruction.

  • unknown Says:

    I keep a lock folder with password and has the password to the folder in it.

  • Hossein Says:

    There is a bug with it!
    If someone chooses " Preview pane" in view title bar, he/she can overview the content in folder locker.bat
    so he/she can find the password!

  • sachin Says:

    what if i accidently deleted thefolder "New Text Document",

  • Ravi kiran Says:

    Awesome............ it works
    use it properly and make sure of your password and don't blame guys............

  • Rudi Rudolph Says:

    Unless I have done something wrong, Right click on the bat file, select edit and you will see what the password is. Does not work for me.

  • weedy Says:

    if u lost work like me just type the title of the work into the search

  • Surya Says:

    Don't use it.
    It's totally fraud.Even though I'm typing the correct password my files are not displayed.
    I lost my valuable files due to this.
    don't dare to do this.

  • Ahsan Says:

    It just hides the files.
    More over anyone can get the password by editing the folderlock file with notepad or anything and look for pass==

  • Vedansh Barthwal Says:

    It is just for hiding the folder. The folder appears when you search on search bar. Not Useful.

  • Ayush Maurya Says:

    if we forgot password then how can we recover it.

    i am typing correct password,but the locker password doesn`nt open.

    please help immedatley

  • Sandra Styskin Says:

    Interesting idea, however the protection provided by this method is extremely limited. Simply enabling "show hidden/system files" will make the files appear again, completely bypassing the password protection in literally a few clicks. Even worse, if you do this for files on a portable device, say a USB stick, and connect it to a computer that has the option "show hidden files" enabled, the files will show up right away! So it's not really a great solution if you want to give a USB stick to a friend and be sure he doesn't see your hidden files.

    Properly password protecting files without additional software is a feature that Windows simply doesn’t have, so the only way to actually password protect your files is to use additional software. If you are looking for an easy-to-use solution, I would suggest Safeplicity (, but I am biased, so don’t take my word for it and be sure to check out some alternatives. If you’re looking for a free open-source solution, VeraCrypt ( is probably the best.

    One last word of caution: when choosing the software, make sure that it not only password protects your files, but also encrypts them. Password protection without encryption (like the one suggested in the article) can be bypassed by any computer-savvy person with ease – we have seen many lives ruined because of this. Password protection with encryption cannot be broken by anyone (unless you believe in conspiracy theories).

    Finally, for everyone who cannot access their data anymore, here are detailed instructions how to get it back: Simply go in Windows Explorer to Options -> Change folder and search options. Now make sure you tick: “Show hidden files”. Also un-tick “Hide protected operating system files”. That’s it. Your “protected” folder will show up again with the name “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”.

  • UltraUnknown Says:

    Hi. Basically noticed a flaw in this. I was editing my own version of this, and noticed it can be viewed via 7-ZIP. Even if you have converted batch to exe, 7-zip can still see the "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D} " folder and that folder is the locker. Within the folder with 7zip, you can still access it's internals.

  • jb2000 Says:


    DO NOT USE!!!!!!!!

  • yuvkiran Says:

    ya it is working fine but one small problem when we searched for that locked folder it is showing everything in the folder can u please implement it!

  • Pankaj Goenka Says:

    Did as told, YET AFTER COMPLETING IT, I can see the folder(Blurr by the way this time), and can open it. Help !!

  • Stu Gravs Says:

    Kudos dude, Kudos :-) worked perfectly !!!!!!!!!!!!!!!!!

  • Jackel Says:

    Helped a lot, thanks *thumbs up emoji*

  • Abhee Says:

    What if .bat file got deleted accidentally from recycle bin ?

  • coleen Says:

    tried this, and when i wannt to open it again sa command prompt always says INVALID PASSWORD :((((((( HELP ME pls

  • Michael Cordero Says:

    This is great! Only issue is the files can still be accessed when the file is searched for from the start menu. Got a work around for this?

  • Cool Kid 22 Says:

    @prathap karaka if you do loose it make do steps 1-14 and you will have the same file back. The coding is made so that is works with a folder named Locker. You can also save another copy of that file onto a flash drive or other thing.

  • Shubham Mistry Says:

    now i am going to store all my porn collection in this folder....
    thank you very much

  • prathap karaka Says:

    hello good morning thanks for such code, its working fantastic. but i have doubt that if i'll lost that batch file then how can i open that folder again.

  • Pabaz Says:

    It worked on windows 10 OS. Thank you.

  • saurav mehra Says:

    if we forgot password then how can we recover it.

    i am typing correct password,but the locker password doesn`nt open.

    please help immedatley

  • Donald Says:

    It worked fine, on the pc side, and I exe the file so its fine, the question I have is the drive I have on a network, does not create the folder from the code, is there a path issue with the code that I'm missing?

  • Alex Ray Says:

    I used this tutorial, but when the folder was locked, a transparent folder appears and the "Locked" files can still be accesses easily without the password. The "Locker" folder never disappears like the tutorial explains. I don't know if it's just me or a glitch somewhere.

  • Thomas Says:

    Nice idea, but no.

    All you have to do is "Edit" the FolderLocker.bat file and you can see the password in a Text Edit window.


    i have done everything as you said but the name of the folder only changes to Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}

  • Duhduh Says:

    This is utterly useless.

    So much work to create a system protected folder that's not really password protected.

    Any Windows user that disables the "Hide protected operating system files" will see this.

  • Charles Goldberg Says:

    I have been using this the past few months. Yesterday I added some files to the Locker and locked it. I then reopened the hidden folder and all my files are GONE. I am at a lost as are my files. These were very important files. Anyway to recover them? Thanks.

  • shyam Says:

    What if I delete that batch file after locking up the files which i want to protect??

    Will the files be visible then.. or will they be deleted?

  • Varun Says:

    Thank you, however the file can be found and opened using search

  • madmax Says:

    awesome, its so easy.....great work

  • hacel Ann tumale Says:

    I do it step by step and all works good but when I try too unlock it and put my pass work can't find it anymore. Pls help me.

  • Devao Says:

    This is so redundant. All it does is make files hidden. I can still read them. Useless.

  • Rachit Taneja Says:

    This procedure just hides the folder. Once you check the show hidden files and folder option you can see a folder named Control Panel... and all your files are in it.

  • Tony Fullalove Says:

    Excellent article, many thanks works an absolute treat in Win 10. no need for any of those dodgy 3rd party SW programmes, thanks again

  • Gbenga Adesina Says:

    This is amazing! Tomb up bro, it worked for me. Re: follow the instruction on the screen shorts closely, it's like ABC

  • Kirstin Fitzpatrick Says:

    The new folder won`t appear! Is there a way for me to cancel this? It`s like I deleted it! It won`t come back. please help me.

  • annonamous Says:

    I try to generate folder, but nothing happens. The screen blinks and no new folder appears. Please help!

  • Amikkumar Says:

    Hey, I lost all my file. It was more than 5000 files collection.

    All steps were good but now when I open FolderLocker.bat and enter my password.. it gives some message "unexpected error" or something and command screen closes. The files does not show up

    Why did you do this?

  • Spiros Says:

    The files are just hidden from view. They are not really protected. All you have to do is click on the View tab on the menu, Options, Vue, and enable the view hidden files and folders. The Locked folder will be visible once again and you can access all the files without a password.

  • raghav Says:

    I was surfing on web and foung ur advice i knew how to do it but never use it because it can be changed easily by right clicking on the .bat file and click edit then anyone can change the password.

  • Rick Zhang Says:

    I have some experience with bat files but I could not have made this. THANKS!

  • Robert Says:

    For some reason my Locker will not lock anymore. The command prompt window to confirm locking comes up but when I put the y in for yes and hit enter the prompt window goes away but the Locker doesn't disappear. Worked great until now. Can you help?

  • Johny Says:

    after i press Y it doesnt do anything

Back to top