• 08:38 Aug 20, 2019

Advertisement

How to lock a folder on Winows 7, 8 and 10?

By: Nirupam Manik, The Mobile Indian, New Delhi Last updated : December 26, 2018 4:03 pm

While you can surely encrypt a file or a folder, you cannot put a password to it.
Advertisement

There are certain files on our PC which we want to keep away from everyone. These might be some important pictures or some documents which you want to keep private. Strangely, Windows doesn’t allow us to lock a specific folder by default. While you can surely encrypt a file or a folder, you cannot put a password to it. There are a bunch of software available on the internet which does allow you to password protect a particular file or a folder, but they are often accompanied by various malware. However, a little labour can help you password protect a folder without installing any third party application.

 

Note, this trick will work on Windows 7, Windows 8 (8.1) and Windows 10.

 

 

Step 1: First, just create a new folder anywhere on your drive where you want to keep your private files or folders.

 

 

 

Step 2: Next, open Notepad and copy the following code to it:-

 

@ECHO OFF

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

if NOT EXIST Private goto MDPrivate

:CONFIRM

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.

goto CONFIRM

:LOCK

ren Private "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 Your Secure Folder

set/p "pass=>"

if NOT %pass%== PASSWORD-HEREgoto FAIL

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

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

echo Folder Unlocked successfully

goto End

:FAIL

echo Invalid password

goto end

:MDPrivate

md Private

echo Private created successfully

goto End

:End

 

Advertisement

Step 3: Replace ‘PASSWORD-HERE’ with the password you want to keep and go to File > Save As > and change the file extension to .bat from .txt and choose ‘All Files’ in the save as type drop down menu. You can name the file whatever you want.

 

 

Step 4: Now double click the .bat file you just created and you will notice that a new folder just appeared with the name ‘Private’. Save all the files and folders you want to keep private in this folder.

 

 

Step 5: Double-click the .bat file once again and a CMD prompt will ask you if you want to lock the folder or not. Type ‘Y’ for Yes and ‘N’ for No.

 

 

Step 6: Once locked, you will notice that the ‘Private’ folder has now disappeared. To access the folder again, just double-click the .bat file and enter the set password.

 

 

This way you can keep all your private files at one place protected by a password. Pro Tip: Name the .bat file carefully as it shouldn’t hint that it contains your password. As a matter of fact, anyone can access your password by just changing the extension of the .bat file. 

You might like this

Tags: Folder Lock Folder Windows 7 Windows 8 Encryption Private Files

You might like this

Matched Content

 

2 Comments

Login with

Naveen Dhanerwal 23 February 2019 10:44 AM

folder is locked and dispeared but to reopen the folder, the bat file isn't opening! When I click on the bat file it just appears and dispears! What to do for it?

Tina Handa 25 February 2019 03:32 PM

This Worked. Thank you