HomeWindows 10How to lock a folder in Windows 10

How to lock a folder in Windows 10

Every singe one of us has a few documents or pictures that doesn’t want to be seen by anyone. If you are the only one using the computer then it’s not a problem, you can just put a password and no one would be able to have access to it. But this becomes a problem is multiple people share the same computer, so in order to keep certain documents private you will need some complex piece of software for it.

It doesn’t have to be complex. There is a simple way to lock a certain folder with a password so that only you can access it. You don’t need any additional software to do it.

How to lock a folder in Windows 10

1.Click on the Windows logo on the left of the taskbar or hit the Windows key on your keyboard

2.Type in “File Explorer” and open it

3.Navigate to where you have the files that you want locked

4.Right click on a blank space and under the “New” menu click on “Text Document”


5.As soon as the document is created you can click on the side or hit enter because the name of the file is not relevant

6.Open the newly created text document

7.Paste in the following code



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


8.Towards the middle of the code that you just pasted in, replace “Your-Password-Here” with the password that you would like to be used to unlock the folder


9.Click on “File” then “Save As”

10.Under “Save as type” select “All files”

11.In the “File name” field enter “Locker.bat”


12.Click “Save” and close the window

13.Open “Locker.bat” by double clicking it. After opening it you will see a folder with the name “Locker” appearing.

14.Move the files that you would want to protect into the Locker folder

15.Once the files are moved, open the “Locker.bat” file

16.A command prompt window will open up asking you if you want to lock the folder. In order to confirm, on the keyboard, you will need to press the letter “Y” followed by the Enter key


17.When the command prompt window closes you will see that the folder with the files that you want to hide is not visible any more

Whenever you need to unlock your files, all you will need to do is open up the “Locker.bat” file after which a command prompt window will open asking you to enter your password in order to unlock the folder. Enter the password and hit the Enter button on your keyboard and your folder will be unlocked. When you want to lock it, just double click on the “Locker.bat” icon.


Frequently Asked Questions and Answers

Q: What if I forget my password?
A: If you ever forget the password that you have set for locking your folder all you will need to do is open the Locker.bat file with notepad and see what password you have set or change it.

Q: How easy is it to hack this password?
A: Fairly easy for someone that know what he’s doing. Please bear in mind that this procedure is not the safest way to hide files that you don’t want to be seen by others. This may only “lock” your files from the people that are not very tech-savvy and won’t be able to find a way to unlock it. If you need a safer way of locking files then you will need some kind of software.

Q: How much files can I lock?
A: As much as you want, there is no limit on the size of files that you put in the folder.

Q: Can I lock another folder inside this folder.
A: Yes, you can lock another folder inside the locked folder.

Slavcho Andov
Slavcho Andov
Part time freelancer, full time geek. An expert in writing articles, but sucks at writing bios.


  1. Very nice info i like it thank you so much

  2. Great post! Your insights are spot on and the way you presented the information was both engaging and informative. I learned so much from reading this. Thank you for sharing your knowledge and taking the time to put this together. Keep up the fantastic work!


Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

Recent Comments

error: Content is protected !!