How to password protect a folder in Windows

Nadin Bhatt
Nadin Bhatt | Writer
Last updated: January 6, 2021
How to Password Protect a Folder in Windows
Disclaimer: Affiliate links help us produce good content. Learn more.

Let’s admit it: we all have certain files on our computer we don’t want anyone to access.

How many times have we wondered if we could protect these files from our nosy family members with a password so that no one can access it except us?

Thankfully, Windows provides you with the freedom to keep certain files hidden from the outside world in a secret folder that is password protected.

No, you don’t need to buy additional software to do that.

Disclaimer: We have tested this method of password protecting a folder internally, and it worked for us. However, to be on the safer side, we highly recommend you conduct a trial run by password locking a few dummy files first. Also, note down your password somewhere safely. If you forget the password, your files will be gone permanently!

Password protecting a folder in Windows 10

  1. To begin with, open the folder where your important files are located. This folder could be located anywhere, even on your desktop.
    step 1 - open the folder where your important files are located
  2. Right, click inside the folder. This will open a contextual menu. Click on New.
    step 2 - Right, click inside the folder. This will open a contextual menu. Click on New.
  3. Next, click on Text Document.
    step 3 - click on Text Document.
  4. This will create a new text file. Press Enter. You can choose to rename this file. This file can be deleted once you have created the lockable folder for you.
    step 4 - Press Enter. You can choose to rename this file
  5. Next, double click on this text file and open it.
    step 5 - double click on this text file and open it
  6. Copy the piece of code given below, and paste it inside the file.
    step 6 - Copy the piece of code given below, and paste it inside the file
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
  • Hit Ctrl + F to find the line where it says ‘Your-Password-Here’ in the text file.
    step 7 -Hit Ctrl + F to find the line where it says ‘Your-Password-Here’ in the text file.
  • Replace this phrase with a strong password of your choice. Don’t forget to note it down somewhere as this password will be used to unlock the folder later on.
    step 8 - Replace this phrase with a password of your choice
  • Click on File > Save As
    step 9 - Click on File > Save As…
  • Change the file type to All Files and save the file with the name FolderLocker.bat
  • Click on Save. This will create a FolderLocker.
    step 11 - Click on Save. This will create a FolderLocker.
  • Now, simply move the files that you want to hide from others in this folder.
    step 12 - move the files that you want to hide from others in this folder
  • Next, open the FolderLocker file, and type Y.
  • Hit Enter, and this will close the FolderLocker file, thus password protecting all your files.
  • To unlock the folder, double click on FolderLocker.
    To unlock the folder, double click on FolderLocker
  • You will be asked to provide your password. Type your password and hit Enter.
  • If your password is correct, you will be able to find all the hidden files. After accessing them, you can choose to lock them again by repeating the same process again.

How to secure your files and folders on the computer

1. Protect your data from an outside attack

Data gets lost, and it is important to ensure proper safety of your files to prevent such events from happening.

One great way to keep your files secure is by using a good VPN (Virtual Private Network). The software creates a private network for you virtually so that all your web traffic is routed through a secure tunnel with proper end-to-end encryption. This ensures that none of your information gets into the wrong hands.

In addition to having a VPN, it is also recommended to have reliable anti-virus software and to keep it updated.

2. Keep your OS updated

We all are guilty of postponing important software updates. Get over this habit, and make sure that your operating system is updated and in line with the recent versions.

This is because the latest updates often include patches and fixes that keep your files and folders safe and secure from the latest threats.

3. Back up your personal data

Develop a habit of backing up your data at least once a week. You can also choose to keep your files on the cloud. This way, even if you lose them on your computer, you can still retrieve them from the cloud.

You could also choose to back up your operating system and programs at least once a month. Thus, even if you somehow lose your data, you will still be able to restore all the important stuff on the go.

The entire process of creating periodic backups might sound like a big hassle at first, but it is well worth it.

4. Use encrypting software

Although the steps mentioned above are easy to follow. However, if they sound too technical for you, you can purchase an encryption software like Wise Folder Hider or SpyHunter to keep your files and folders protected!

With the ever-rising cyber threats and crimes, it is essential to play it smart. Make use of the tips we discussed above, and stay safe on the go.

Recommended reads:

Best VPN for Windows

Leave a Reply

Your email address will not be published.

  1. Just D

    Recently I started feeling the need to lock a folder at home. I’m living with someone, a roommate and while I trust her, I don’t trust her completely so… Thanks for teaching me how to encrypt files in windows 10. Now that I know this I think I will lock a few more folders. I’m liking this :)).

  2. Kiri

    I’ve been worried about my files for a long time. I’ve been able to lock Word documents, but it’s a load off my mind that I can password protect my folders! I thought I’d have to buy something to encrypt everything. A folder locker is way better for me.

  3. Adriana

    What I want to know is how to password protect a folder on mac? Could you please create a post about this and maybe recommend a folder and file locker that works well on mac? There are a few out there but I don’t know what to choose. I really like the site and would like your advice/opinion if possible, thank you so much. Will be back soon to check if you replied ;). Thanks in advance even if you don’t have time to reply, Nadin! xoxoxo

    1. avatar
      Nadin Bhatt Author

      Hi Adriana,

      We may indeed create that post in the future. Fortunately, locking a folder on Mac is fairly easy and there are good tutorials, such as the one on Laptopmag.

      Good luck!

  4. 7Pep

    I want to know how to lock a folder in windows 7 without software. Do you have a page for this?

    1. avatar
      Nadin Bhatt Author

      Hi 7Pep,

      Unfortunately, we don’t, but the process described here works for Windows 7 too.

      Good luck!

  5. Maxxie

    Backing up your personal data is a must nowadays. I do this weekly just to be safe. I didn’t use to need protection but I had to learn how to password protect a folder in windows 10 for work because I have some suspicions that someone has been taking a peek into my files and I hate that. I feel violated and have taken a few measures to make sure no one besides myself can access my files. Maybe I am overreacting and no one is actually looking in my files but I feel safer knowing no one can access them without my knowledge. I started learning a lot more about how to protect your computer and files both at work and at home/online. It’s amazing how many things you can do to protect yourself and most of them are free and easy to set up. It just takes a bit of time to learn how to do them.

    1. Jordy

      Even if nothing happened, it’s a good idea to know how to lock a folder in windows 10 because you don’t want others to be able to see or modify the projects you’re working on. Make lots of backups and save your data in multiple places online, on a USB drive, at home, etc. Don’t just rely on a single save, a single backup; do a few so if something bad does happen you’re covered. And yes you can learn a lot of things about how to protect yourself offline and online if you take a bit of time to learn. Tip: look for a master folder locker as it will help a lot. There are many free and paid options available.

  6. Josh Coulton

    Great option given! I have always wanted to have a password protected folder and wondered how to achieve it. I checked your method and it’s working 100%. Thank You!

  7. Frige Limbikani

    I’ve wanted to do this for sooo long, thanks guys! Not just for security (in case my laptop gets stolen), but also since my mum sometimes uses my laptop. I have nothing to hide, but just to be sure…

  8. Peter J. Nygaard

    Just another example of the many tools on our computers that we often don’t even know about. I bet I’m lucky if I know about 50% of the things my computer can do for me and I consider myself fairly literate when it comes to my PC. Thanks for posting this helpful tutorial on adding another security fence around my precious information. I use a VPN, antivirus software, and now I can add this.

Table of Contents:
Thanks for your opinion!
Your comment will be checked for spam and approved as soon as possible.