How to Password Protect Files & Folders on Your Computer

I understand that you may have many concerns, and the possibility of others accessing your sensitive files can be quite upsetting. One thing we tirelessly strive to do is safeguard our precious data. If you’re hesitant to download extra software that could potentially hamper your computer’s speed, this method enables you to password-protect your files.

One thing to keep in mind is that this method won’t hide your files from someone who really knows their way around a computer, but if you are surrounded by beginners, then this is the method for you.

How to Password Protect Files and Folders on Windows

The first thing that you will need to do to add a password to your Windows folder is to create a folder like you normally would in documents. You can name this folder whatever you want, and as you can see in the image below, I called mine “Secret Love Letters from Famous People.”

Password to a Folder

Go to and open the file you just created and create a new Text Document. Once it’s open, you will need to paste the following codes:

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

Scroll back up slowly and look for the words that say “password goes here” and change it to the password you want to use to protect the folder. Remember to create a password that is not easy to crack.

You will need to save that text document as “FolderLocker.bat”.

Password to a Folder

Note: You will have to choose Save as Type >> All Files to do this.

Click on the file that says “FolderLocker” and you should see a folder called Locker or Private. This is the file where you should transfer the files you don’t want anyone to see. Now, you can hide those pictures you don’t want your buddies to see every time they ask to use your computer.

Go back to the Folder Locker file and double-click on it and the command prompt should appear asking if you if you are sure that you want to add a password to your folder. Type “Y” and press Enter.

Password to a Folder

Don’t panic if the folder disappears, because that’s exactly what it’s supposed to do. Whenever you want to access your important documents, double-click on the FolderLocker file and the command prompt will ask you to type the password.

Password to a Folder

After you have done that, the file should reappear. Congrats! You have just learned how to add a password to a file in Windows. It wasn’t that hard, was it?

What To Do If You Forget Your Password

Have you ever had to reset your password on any of your accounts? If you’re like me you have and many times for that matter. If you happen to forget the password you set for your folder, all you have to do to see it is right-click on the locker.bat file and choose Edit. It’s that simple, but make sure that you don’t do this in front of anyone since they to will find the way to see your password.

Password to a Folder


We are constantly trying to find ways to protect our information and adding a password to files is a great way of keeping things safe. How do you keep your files safe? Let us know in the comments.

Read more like this

5/5 - (2 votes)

Judy Sanhz
Judy Sanhz

I can never get enough of tech in general, whether it's Android or web apps, but helping others solve their tech problems also brings great satisfaction. I carry a device wherever I go and I'm always connected. Life without Internet just sounds too scary to me. :-).

Notify of

Inline Feedbacks
View all comments
MrHow - Tutorials Related To Windows, Mac, iOS & Android