How To Password Protect Folder Using Windows

Affiliate disclosure: In full transparency – some of the links on our website are affiliate links, if you use them to make a purchase we will earn a commission at no additional cost for you (none whatsoever!).

Most of the times, we would rather keep our data private! So a situation often occurs when we want our data to be inaccessible by others. If you use a computer regularly you might have some sensitive files saved on your computer that you would never want others to find out about!

These files contain a myriad of delicate documents regarding our professional and personal life.  So often it’s a better option to password protect folder and files so that no other user would be able to access them.

Today, I am going to teach you how can you password protect a folder and a file. While there are certainly many ways to password protect folder, the disappointing part is that Windows doesn’t allow us to do that natively. Rather we have to take the support of third-party software.

Let me show you what software we need and what are the steps. Don’t panic, it is a simple yet working guide.

How To Password Protect Folder

As I said, you need to install third-party software to protect a folder with a password. There are more than one methods to password protect a folder. I will be showing two of them. One, using a third-party software another via coding.

Ok, let’s head towards the guide.

1. Password Protect Folder Using Third-Party Software

Note: Before proceeding to the steps make sure you take your file’s backup, In case you forget the password in future.  

  • First of all, you need to install a third-party software named 7-Zip. You can directly download it from this link. Download, as per your requirements and install it on your system.
  • Afterward, when you are done installing, open it.
  • You can see the list of all the folders you have on your computer. Select the folder you wish to make password protected and click on green addition sign in the upper-left corner of the software. For more have a look on the screen screenshot.

Proceeding to the next step, you will be redirected to a new window where you can put desire password accordingly. ( you can find the password field just beneath the encryption section). Type and confirm the password by re-entering it. Now click on the OK button. See the screenshot.

  • Once you are finished by clicking Ok, you can see the encrypted file will lead you to two copies, one the original and the second is password protected.
  • With the above step, a password protected folder is created. Now delete the unprotected (Original) folder. That’s if you have managed to lock your folder.

While the above method does work well, this method means that other users can still view the file names. They won’t be able to access the data, though. But, If you wish to make your folder as well as files to be hidden then the below method may suit you better.

2 Password Protect Folder Using Code

Before moving to the method, you need to create the main folder where you will save your password protected folder.

Straightaway, Go to your recently created folder and create a New Text Document.

  • You can do that by Right Click> New> Text Document. Open the Notepad (Text Document) and paste the code(I have provided below) to its content.
title Folder Private 
if EXIST "HTG Locker" goto UNLOCK 
if NOT EXIST Private goto MDLOCKER 
echo Are you sure you 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 Private "HTG Locker" 
attrib +h +s "HTG Locker" 
echo Folder locked 
goto End 
echo Enter password to unlock folder 
set/p "pass=>" 
attrib -h -s "HTG Locker" 
ren "HTG Locker" Private 
echo Folder Unlocked successfully 
goto End 
echo Invalid password 
goto end 
md Private 
echo Private created successfully 
goto End 
  • Replace the word PASSWORD_GOES_HERE with your own password. And save the document with the name locker.bat.
  • Once you are done saving the file. A new batch file will be created along with your folder. Once the batch file is created, delete the original text file.
  • Run the batch file by double-clicking on it.
  • If you notice, after clicking on batch file a new folder named Private would be created. That’s it. This is the folder you can use to store all your personal stuff.
  • Move all your important sensitive data to that folder which you want to keep private. Once you are done shifting your data to the private folder. Run the locker.bat file again.
  • A cmd window will appear before you and you will be asked if you really want to lock the folder
password protect folder
  • Press Y from the keyboard and hit enter. Your private folder will immediately disappear. That’s it. You are successful in locking your private data.

Now, if you want to get your data back, repeat the last step (run the locker.bat file again. this time, you will be prompted to enter a password).

password protect folder

Enter the password you kept in the code and the folder will reappear immediately. This is how you can hide your folder secretly. No one would ever get if there was any folder hidden.

Things To Keep In Mind While Encrypting Your Files and folder.

  1.  There are many programs that help to lock your files and folders like, LocK-A-FoLdeR, Folder GuardFolder Lock Lite, and many more. But, install them one at a time. Installing more than one program at once may lead to various issues.
  2. Even though a folder is password-protected, it can still be deleted until the program itself supports protection from being erased. So always try to keep a backup.
  3. Last but not the least, after following the above guide if somehow you forget the password, or are unable to get the folder back then, you can find them by checking the radio button “Show hidden files. See how-

With this last step, I am done. I hope if you had ever wondered how to lock a folder and how to make a password protected folder, then you must have enjoyed the article. If so then do share it with your friends.

For more interesting articles on windows, do check out this link.


A graduate of the IIMC, Diksha enjoys testing out new tech products and services. Her goal is to help others make more informed purchases of tech products and services. In her spare time, she enjoys traveling, watching movies, and listening to music. An ardent reader loves to be surrounded by technology.

Leave a Comment