How to Password Protect a folder in Windows?

password protect folder

Everyone has something which he/she doesn’t want to share with the world! Thus, each PC could be having at least one folder which is not meant for everyone to view. People hardly know about the fact that they can password protect their sensitive folders and prevent them from landing into the wrong hands. Also, there are not many methods available to do it! Thus, to protect your private data from leaking, you can make use of the method listed below to password protect a folder in Windows PCs.


There are a number of steps to be executed in this method. Thus, pay attention while executing each step on your PC. If you do not execute the steps in correct order or if you do not execute it properly, you will not be able to accomplish your task of password protecting a folder in your Windows PC.

The method used to Password Protect a Folder in Windows is:

Step 1- Click on the ‘Start‘ icon located at the bottom left corner of your screen or press the Windows key to open ‘Start’ on your PC.

Step 2- Now, in the Start Menu, click on the ‘File Explorer‘ option to launch your File Explorer/Windows Explorer.

Step 3- Now, navigate to the location where you have saved the folder which you want to password protect!

Step 4- Here, right-click on the screen, go to ‘New‘ from the drop-down box and select ‘Text Document‘ and save it.

Step 5- Now, launch the document which you have just saved by double-clicking on it and ensure whether the ‘Word Wrap‘ option is enabled or not. It not, make it otherwise!

Step 6- You are now supposed to copy the code given below and paste it into the document as it is!

title Folder Locker
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
echo Are you sure you want to lock this 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

Step 7- In the line ‘if NOT %pass%==Your-Password-Here goto FAIL‘ you have to enter your desired password in place of ‘Your-Password-Here.’

Step 8- Once you have changed the password, you now have to save it. To do this, go to File >> Save as. Now, change the ‘Save as type‘ column to ‘All Files‘ from the drop-down box.
Change the name of the file to ‘FolderLocker.bat‘ and click on ‘Save.’

Step 9- Now, double-click on the just saved file to run the code which you had pasted in it. You will notice a new folder with the name ‘Locker‘ in the same location where you have saved the code.

Step 10- Select all the files and folders which you wish to password protect and move them to the ‘Locker‘ folder.

Step 11- Double-click on the ‘Locker‘ folder to launch the Command Prompt. Here, press ‘Y‘ and hit Enter to lock all the selected files.

You will now need to enter the password which you had set in step 7 to access the locked files and folders.

An Advice from us:

If you are bad at remembering passwords, write this password down or create a backup of the files which you put in the ‘Locker‘ folder. This will help you in securing the password protected files if you forget your password. However, if you currently using windows 7 then you can upgrade to windows 10 for free. So that you will get more security updates to secure your PC.


This is how you can password protect any folder on Windows PC and protect your personal data from prying eyes. However, If you get stuck at any step or if you have any doubts regarding the above method, then please let us know about it in the comments section below.

What do you think?

Written by Alex Brian

My name is Alex Brian, and I am a Web Content specialist, Travel enthusiast and Blogger. I write for many well known blogs and try to present my critical take on the latest socio-cultural trends that dominate the blogosphere


Leave a Reply

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