How To Password Protect A Folder In Windows 10?


When it comes to protecting your data on Windows 10, putting a lock screen password is the first thing you do. By doing that, you try to protect data stored in every folder on your PC. However, what if you have to hand over your system to someone else for a brief time period?

I mean, all of your data will be exposed and can be exploited by the other person without your knowledge. Well, in that case, the best thing you can do is password protect a folder that contains your essential data.

But when it comes to Windows 10, there’s no direct way to lock folder in Windows 10. You’ll have to make some effort to get that done, and I am going to tell you how.

Methods To Password Protect A Folder In Windows 10

There are two methods to lock a folder in Windows 10:

  1. Text-based Folder Lock (Creating Batch Scripts)
  2. ZIP lock Folder

Password Protect A Folder In Windows 10 Using A Batch (BAT) File

In case you’re wondering what a Batch file is, then you can read all about it in our detailed post.

Just follow these steps to password protect a folder in Windows 10 without any software.

Note: Before you follow the given steps to lock a folder, I recommend you to create a backup of your data to be on the safe side.

  1. Open the folder that you want to lock.
  2. Within the folder, right-click in the empty space and navigate to New>Text Document.
    create text document
  3. In the black text document, copy and paste the following code:
    title Folder Locker
    if EXIST “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” goto UNLOCK
    if NOT EXIST Locker goto MDLOCKER
    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
    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 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
  4. In the code, find the if NOT %pass%==Your-Password goto FAIL line.

    your password
  5. Replace the Your-password bit in the line with your own password.input your password
  6. Now, click on File and select the “Save As” option.
    save text document
  7. In the Save as type dialog box, change the file type to All Files.
    save as type
  8. Next, change the file name to anything, however, use the .bat extension at the end of the name.
    create batch file
  9. Now, you’ll see a newly created Batch file in the folder.
    batch file created to lock a folder in windows 10
  10. Double-click on the newly created Batch file and a new folder will be created by the name Locker.
    folder created
  11. Move all the files you want to protect in the ‘Locker’ folder.
  12.  Launch the Batch file again and type y to password protect the folder.
    password protect a folder in windows 10
  13. Then, press ENTER, and you’ll see that the folder will disappear.
    folder locked
Also Read: How To Reset Windows 10 With And Without Password

How To Get The Locked Folder Back?

  1. To get the Locker folder back, double-click on the Batch file.
  2. Next, type the password you’ve previously assigned to the folder and hit ENTER.
    unlock the password protected folder
  3. That’s it; the folder will appear right back in front of you.
    folder unlocked

Password Protect A Folder In Windows 10 Using A Compression Software

We’ve already told you about many compression software. However, you may not know that some compression software allow you to lock and encrypt a folder in Windows 10, like 7-ZIP.

  1. First, download and install 7-ZIP on your system.
  2. Next, in the 7-ZIP app, locate and select the folder you want to lock and click on the + icon in the top left corner.
    locate the folder to lock
  3. Now, enter your desired password in the encryption section and click on OK.
    ZIP lock folder in windows 10

A new encrypted and compressed file will be created with the same name as the original folder.
compressed file created

However, this process won’t delete the original “unlocked” folder by itself. So, you’ll have to do that by yourself.

Now, if you want to access the locked folder, just try extracting the ZIP file, and it will ask you for the password before extracting.
password protect a folder using ZIP

Also check out our article on how to run bat file as administrator on windows with this detailed step by step guide here!

How To Hide Files and Folders In Windows 10?

If the previous two methods are time-consuming for you, then you can always follow the traditional method to protect a folder in Windows 10, i.e., hiding a folder.

The process of hiding a folder in Windows 10 is something that almost every Windows user knows. However, if there’s a chance that you don’t know how to do that, then here are the steps:

  1. Right-click on the folder you want to hide and click on Properties.
    folder properties
  2. Besides Attributes, check the Hidden option and click on OK. The folder will now be completely hidden from you and the others.
    hide files and folders in windows 10

However, you can see the hidden folders by clicking on the View tab of the Windows 10 file manager. Then, you have the check the box for Hidden items.
see hidden folders in windows 10

You can also unhide the folder by going back to the folder’s properties and unchecking the Hidden option.

I hope that at least one of the methods helped you to lock a folder in Windows 10. Even though hiding a folder is much easier than other methods discussed above, I would still recommend that you opt for the text-based or Zip Lock folder method. That is because even a child knows to access the hidden folders in Windows. Also you can read our article on what is kensington lock slot in laptop in details here!

Shivam Gulati

Shivam Gulati

Shivam is a blogger who is always fascinated with technology and the amount of knowledge he can gather from the internet. He is trying to nerdify everyone around him with that same knowledge, through his writings. He enjoys gaming in particular, so he tries to keep track of what’s new in the gaming community and write about it. Visit his Gaming Channel IntroGamers on YouTube.
More From Fossbytes

Latest On Fossbytes

Find your dream job