How to password protect a folder in Windows 10

Password protect a folder in Windows 10

We all have computer files we'd like to protect and keep completely private, but not everyone knows how to password-protect a file folder in Windows 10. Whether you're hiding notes from someone (spouse, child, co-worker) with access to your computer or (hopefully) something less drastic, you're allowed to have some privacy. 

Fortunately, in Windows 10, you can securely protect your private documents or files in a secret folder that is password protected, and you can do it without buying any additional software. Once you've created a new folder in Windows 10, here's how to password-protect it. You can never be too careful when it comes to privacy

A note before you start:

We've received comments about issues people have run into with this how-to. So, we went back and performed multiple rounds of testing internally and can now confirm that following this process closely, step-by-step, works — at least on our end.

But to be safe, you should try this how-to using files you can afford to lose, just in case the method doesn't work for you. Also, ensure you're keeping some record of the exact password you're using to lock your folder. 

Please Note: If you lose the password, your files are gone, and since every computer is different, we can't deduce exactly what went wrong on your end.

Also, yes, the FolderLocker file can be reverse-engineered by someone who understands the process, but this isn't meant to keep tech-savvy folks out, just nosy family members who you don't trust.

Tips from readers: 

Here's how to password protect a folder in Windows 10, so you can fill it with files you want to keep secret — and how to 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.

2. Select "New" from the contextual menu. 

3. Click on "Text Document."

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.

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

6. Paste the below text into the new document:



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.

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

9. Click File.

10. Select "Save As..."

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

12. Select "All Files"

13. Change the file name to "FolderLocker.bat"

14. Click "Save."

15. Double-click FolderLocker.

The Locker folder has been generated!

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

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

18. Type "Y" into the screen.

19. Click Enter, and the Folder Locker window will disappear, along with the Locker folder itself. Your secrets are now safe.

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

Enter the password you entered in Step 8, and 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.

To learn more about how to make use of your laptop, check out our guide for what to do as you set up your new laptop. We've also got instructions if you're trying to figure out how to reset Windows 10 PCs and how to reset your password in Windows 10. Lastly, tired of Windows? We've got a guide that answers the relatively new question of "Should I Buy a Chromebook?"

If you find yourself running into serious Windows issues, you might need to take advantage of that extended warranty and give tech support a jingle. Check out our Tech Support Showdown to see how each laptop manufacturer stacks up on the back end.

Windows 10 Security and Networking

Avram Piltch
Online Editorial Director
The official Geeks Geek, as his weekly column is titled, Avram Piltch has guided the editorial and production of since 2007. With his technical knowledge and passion for testing, Avram programmed several of LAPTOP's real-world benchmarks, including the LAPTOP Battery Test. He holds a master's degree in English from NYU.
With contributions from