How to Password Protect a Folder in Windows
Whatsapp Pinterest
Advertisement

Take a second to consider how much sensitive information you have stored on your computer at this moment. Bank information? Family photos? Financial documents?

As secure as your files feel on your PC, they’re also prime targets for malicious intent. Password protecting your sensitive folders is a basic security step. Think of it as a virtual vault, which encrypts whatever files or additional folders you’d need kept safe.

Read on to learn how to create a password-protected folder to keep your precious files protected, and sneaky onlookers at bay.

Method 1: Text-Based Folder Lock

While Windows 10 doesn’t allow users to password protect folders by default, you can use a batch script to lock folders using a password of your choice. If you aren’t familiar with batch scripts How to Write a Simple Batch (BAT) File How to Write a Simple Batch (BAT) File Batch files can automate everyday computer tasks. We'll show you how batch files work and teach you the basics. By the end of this article, you'll have written your first batch file. Read More , here’s a primer.

Start by navigating to the folder you’d like to lock. I’ll create a new folder to use as a virtual safe named Safe.

Double-click the folder. You’ll be creating your batch file within the directory that’ll store your locked folder. Create an empty text document within your folder by right-clicking an empty space and selecting New > Text Document.

How to Password Protect a Folder in Windows new text document

Within this document, copy and paste the following code:

cls
@ECHO OFF
title Folder Locker
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Locker goto MDLOCKER
:CONFIRM
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
:LOCK
ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
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
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Locker
echo Locker created successfully
goto End
:End

To set your password, change the your_password bit in the line if NOT “%pass%==your_password” goto FAIL to a password of your choice:

How to Password Protect a Folder in Windows change password locker bat

Once you’ve added your password, head to File > Save As within your Notepad program. Name it anything you’d like, Locker in my case, but ensure you add a .bat extension to your file. In my case, I will name my file Locker.bat (ensuring I’ve included the extension).

Double-click the BAT file to create your Locker folder. This is the folder that will be locked with your password. You should now have a folder and a file named Locker.

How to Password Protect a Folder in Windows locker file and folder

Place all your sensitive documents within this Locker folder. Once you’ve placed your files, double-click your Locker.bat file again. A command prompt will open asking if you want to lock your folder. Input Y and press Enter.

How to Password Protect a Folder in Windows locker cmd prompt lock

Poof! Your folder should disappear. This is a natural byproduct of your BAT file.

To access your files again, double-click on your Locker.bat file. You will be prompted to enter the password you added when creating the file.

How to Password Protect a Folder in Windows locker cmd prompt unlock

Voila! If you enter your password correctly, your Locker folder will reappear again.

Note: This BAT file can be changed via your PC. That means others who are familiar with this trick may be able to change your password. For the most part, however, this nifty little trick will add a much needed buffer to your most sensitive local documents!

If you’d like to learn more about what BAT files can do How to Use Windows Batch File Commands to Automate Repetitive Tasks How to Use Windows Batch File Commands to Automate Repetitive Tasks Do you frequently execute boring and repetitive tasks? A batch file might be exactly what you’re looking for. Use it to automate actions. We'll show you the commands you need to know. Read More , we’ve got you covered.

Method 2: ZIP Folder Lock

While the above trick uses the default Notepad program, you can also both lock and condense your sensitive documents using a popular desktop program named 7-Zip.

Typically used to unzip folders and extract files, 7-Zip also allows users to password protect their folders. To follow this method, first download 7-Zip.

Once 7-Zip is downloaded and installed, click the start menu and type 7zip. Select the 7-Zip File Manager option. Then, locate the file or folder you want to protect, click on it, and click the Add option at the top of the window.

How to Password Protect a Folder in Windows 7 zip add

Next, enter your new password in the Encryption section. When you’re done, click OK. Check your folder location and you’ll find a ZIP file named the same as your original folder.

How to Password Protect a Folder in Windows 7 zip locked

Now that you have your zipped file, delete your original folder (as keeping it would defeat the purpose of password protecting your new ZIP file).

It’s a good idea to create another containing folder for your zipped file, as unzipping it may scatter your files in a directory. In the example below, the Sensitive Documents folder will hold my zipped Safe file.

Right-click your zip file and select 7-Zip > Extract Here. You’ll be prompted to enter your password.

How to Password Protect a Folder in Windows zip file password enter

Enter your password and your files will appear in your directory.

How to Password Protect a Folder in Windows extracted 7 zip

That’s it! While this method isn’t exactly timely, since you have to undergo the whole process every time you need to add or view your files, it works perfectly and only uses this trusted software.

Method 3: Hide Files and Folders

Now that you’ve locked your folder, you can also take the additional step of hiding your folder from view How to Hide Files, Folders, and Drives in Windows 10 How to Hide Files, Folders, and Drives in Windows 10 Do you need to hide files and folders on your computer? Here we cover five ways to hide files, folders, even drives on Windows. Read More .

Right-click a file or folder or your choice and select Properties. Check the Hidden option beside Attributes. Click Apply and then OK.

How to Password Protect a Folder in Windows hidden check

Your file or folder should now disappear. To view your folder again, click on the View tab of your Windows 10 file manager. Then, select Options > Change folder and search options.

How to Password Protect a Folder in Windows change folders and search options

In the following File Options window, click on the View tab. Finally, click on the option labeled Show hidden files, folders, and drives under Hidden files and folders. Click Apply and then OK.

How to Password Protect a Folder in Windows hidden files and folders

You should now be able to view your file or folder. To revert your file or folder back to hidden, head to your File Options window again and select Don’t show hidden files, folders, or drives. That’s it!

Lock Your Windows Folders to Keep Your Data Safe

With the simple methods above, you can choose to implement either one or all three. No matter which you pick, you can rest assured that your previous sensitive documents are safe under an additional layer of protection not enabled by default on your PC.

Sometimes, all it takes is a password lock to prevent theft. That applies to the virtual world as much it does to the real world. And it’s up to you to bulletproof your PC with the best security tools for your computer The Best Computer Security and Antivirus Tools The Best Computer Security and Antivirus Tools Need a security solution for your PC? Concerned about malware, ransomware, viruses, and intruders through your firewalls? Want to back up vital data? Just confused about it all? Here's everything you need to know. Read More .

Enjoyed this article? Stay informed by joining our newsletter!

Enter your Email

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Ali
    July 17, 2018 at 6:14 pm

    nice work man , but anyone can change password by simply right clicking and opening .bat file by notepad..., moreover you can directly access to that files you hide by simply pasting this in address bar of file explorer when you are in that folder where folder locker.bat file exists...like this"D:\Camera Backup\Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"

    only paste this" Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D} " in that folder's address bar where bat file is.. and you are done

  2. EasyTechGuides
    September 8, 2017 at 6:30 am

    The "Folder Locker" is NOT secure!, because someone only needs to right-click on the batch file and choose "Edit" and your password is visible.

  3. Tom
    August 19, 2017 at 4:07 pm

    It's no good if you right-click on the ".bat" file, and select "edit" the code will look. So invalid this way to lock files and folders !!!!!!!!!!!!!!!!!!!

  4. Swarup
    May 13, 2017 at 2:55 pm

    I have been using the first method from a year. Today all of the sudden the locker folder turned out to be empty. I tried locking and unlocking the folder and the outcome was same. All the contents inside the locker folder is gone! Is there a way to get those back! I had some personal stuffs. Please help. Thanks in advance :)

    • Gman911
      November 20, 2017 at 8:00 am

      I believe you just copy this code below into the text file again and ensure it is saved as a .bat file. Change the PASSWORD in the code to whatever your password was, and I think it will open it. Good Luck!

      cls
      @ECHO OFF
      title Folder Locker
      if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
      if NOT EXIST Locker goto MDLOCKER
      :CONFIRM
      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
      :LOCK
      ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
      attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
      echo Folder locked
      goto End
      :UNLOCK
      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
      :FAIL
      echo Invalid password
      goto end
      :MDLOCKER
      md Locker
      echo Locker created successfully
      goto End
      :End

  5. Easter Bunny
    April 15, 2017 at 10:16 pm

    I use AxCrypt

  6. Liz
    January 12, 2017 at 1:02 pm

    Thank you so much! Easy peasy, and I feel like a spy.

    • Bala Murali
      April 4, 2017 at 2:06 pm

      By spy you mean sitting in a dark room alone and masterbating?

  7. OD
    August 18, 2016 at 3:49 pm

    This method could not be any worse for protecting a folder

  8. Arthur
    August 5, 2016 at 6:25 pm

    Is the "Using a Folder Locker" method, which I've also seen elsewhere, a well-traveled joke or something? One can just open the Locker.bat file in an editor and read out the password and use it to unlock the folder. Unless I'm missing something, of course.

  9. barry
    April 13, 2016 at 1:13 am

    I have used "Protect My Folders" for two years. It also supports Windows 10.

  10. alsen
    April 6, 2016 at 1:02 am

    I suggest Gilisoft File Lock Pro to password protect folders, it can lock folders on an internal hard drive, flash drive, external USB drive, thumb drive, memory card, pen drive, and network drive.

  11. Ankit
    April 5, 2016 at 5:56 pm

    I use secure folders. easy and straight forward

  12. Sydney
    March 31, 2016 at 9:56 am

    i like the first one, im always curious to figure out what more can I do on my computer. thank you #makeuesof for great articles all the time.

    • Tina Sieber
      May 2, 2016 at 7:55 am

      You're welcome, Sydney! Thank you for taking the time to give us feedback!

    • EasyTechGuides
      September 8, 2017 at 6:35 am

      The "Folder Locker" is not secure, because someone only needs to right-click on the batch file and choose "Edit" and your password is visible.

  13. Anonymous
    March 30, 2016 at 8:49 am

    I used SecretFolder. It's simple and free.