Hide and Lock Windows Folder

“Everyone has something to hide”. While this expression is somewhat vague but accurate and applies to each one of us. Android apps like AppLock are readily available in the Google Play Store and most of us tend to use it but Windows alternative to AppLock is not as popular (yet).  What if I tell you that you can also protect your folders in your Windows! And that too it’s not difficult to do either just read on.

All you will need is this article and that’s it. Just follow the steps.

STEP 1: (Might not work in C Drive)

Either create a folder with all the subfolders you want to protect or else just go anywhere where               you want to keep your password protected folder.

Right Click>>new>> Text Document

STEP 2: In the notepad window thus appeared copy and paste the following code:

cls

@ECHO OFF

title Folder Lock

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

if NOT EXIST Locker goto MDLOCKER

:CONFIRM

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.

goto CONFIRM

:LOCK

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

attrib +h +s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”

echo Folder locked

goto End

:UNLOCK

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

:FAIL

echo Invalid password

goto end

:MDLOCKER

md Locker

echo Locker created successfully

goto End

:End

NOTE: You can use your own title(first line of code)

STEP 3: Now change the password to whatever you want in the place shown in above photo.

My password here is PrefEdge. You can choose whatever you like.

STEP 4: Now Save your file

File>>Save as >> change the name to your title with .bat (here FolderLock.bat)

And remember to change the type to All files

STEP 5: After saving the text document with you will get a batch file woth your given name(here FolderLock)

Now double click the FolderLock file

After Double Clicking the FolderLock you will get a folder named Locker.

STEP 6: Now move the files and folder you want to protect into this folder Locker.

STEP 7: Now again double click the FolderLock , This time you will get a command window asking

Are you sure if you want to lock the folder, type y or Y for yes and n or N for No.

Press y and your folder will be locked and will disappear from the screen.

STEP 8: Now to again gain access to your secret folder, again double click on FolderLock , this time it will ask you to type the password.

 If you type the correct password your folder will reappear and if you type the wrong password if won’t do anything.

And as showed earlier our password was PrefEdge.

After putting the password, the Locker folder will reappear.

So, every time you want to lock the folder, just double click the FolderLock and type y and that’s it.

Hope this was helpful.

While this is a very useful trick please note that it is not perfect. One can still open the folder without knowing the password or can easily get the password. Well hoe one can do so is explained below:

Method 1 – As we used just notepad to create code and we then just changed the file extension, if anyone cared to open the FolderLock.bat file in any text editor he/she can easily find the password written.

Method 2 – While it is true that the folder doesn’t appear if anyone unhides files but if he/she is smart and know his/her work around the folder options he/she can go to advanced properties and uncheck the “Hide protected operating system files”. After that your hidden and locked folder will be visible to all.

Prakhar Lohiya
Prakhar Lohiya

Writer

An adventurer, photographer, writer,who loves coding. Prakhar had been fascinated by machine learning and is currently enhancing his skills. He just Loves the new tech mostly the gadgets and science behind it.