How To Lock A Folder On Windows 10

There are always some important files and folders which you might want to keep away from prying eyes. However, Windows doesn’t give you a straightforward way to lock a specific folder by default. Here’s How To Lock A Folder On Windows 10.

Nowadays due to corporate espionage or sometimes a jealous partner is not the only driving factor behind what’s driving users crazier than usual about digital security.

Above all, the knowledge that someone might be informed to your private information is something that can make anyone cringe.

Moreover, private data and important documents that you want to keep private are not things users might feel comfortable to just leave lying around in your computer where anyone can get easy access to it.

However, we do have the option of encrypting a folder or a file but there is no straightforward way you can it with a password.  In addition, resorting to a third-party application can might slow your system down with malware.

For instance, a little bit of work can help you password-protect your folder without relying on any third-party applications. Furthermore, follow these steps to do so.

Here’s How To Lock A Folder On Windows 10 :

Step 1: Firstly, create a new folder on your drive. This will be the location where you want to store your private pictures and folders.

Step 2: After that, you have to open notepad and copy the code given below into it.


if EXIST “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” goto


if NOT EXIST Private goto MDPrivate

Related:  Delete All Friend Request Sent At Once In Facebook


echo Are you sure 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 Private “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 Your Secure Folder

set/p “pass=>”

if NOT %pass%== PASSWORD-

HEREgoto FAIL attrib -h -s “Control Panel.


ren “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” Private

echo Folder Unlocked successfully

goto End


echo Invalid password

goto end


md Private

echo Private created successfully

goto End


Step 3: After that, just replace the option called ‘PASSWORD HERE’ with the password that you wish to assign for your folder. Then go to File > Save As > then again, change the file extension to .bat from .txt and then again, choose ‘All Files’ in the save as type drop-down menu.

Then you can save the file as whatever you want.

Step 4: Now double click on the .bat file that you have just created. Then you will also, notice a new folder has appeared. The new name will be named ‘Private’ and this is where all the files and folders will be saved.

Step 5: After that, double-click the .bat file once again. Again, a CMD prompt will ask you whether you want to lock your folder or not.

In case you wish to lock your folder then, you will have to type in Y meaning, yes. Similarly, if you do not want to lock your folder you will have to type N meaning No.

Related:  How to Disable the First Sign-In Animation on Windows 10

Step 6: Once it has been locked, the folder named ‘Private’ will disappear. Furthermore, in order to access the folder again, all you need to do is double click on the .bat file then enter the password you have set.

Recent Articles

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here

Copyright © 2017 - 2023 . All rights reserved.