How to Password Protect a Folder in Windows


Although Windows does not offer a native "password lock" feature for folders, there exist several ingenious alternatives to safeguard your confidential files and enhance their security. Below, you will find a few practical alternatives worth considering.

1. Lock the Folder Using a Batch File

If you prefer not to use third-party apps and programs, creating a batch script can be the most effective method to lock folders with a password of your preference. Here is a step-by-step guide on how to do it:

1. Find the folder you want to lock and open it.
2. Right-click on an empty area within the File Explorer window and choose New > Text Document.
3. Copy and paste the provided code into the text document:

@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%==your_password goto 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 
4.In the text file, replace your_password in the 
line if NOT "%pass%==your_password" goto FAIL to a password of your choice.

5 Access the File menu located at the top and opt 
for the Save As option.
6 Assign any desired name to the file and append the .
bat extension at the conclusion.
7 Choose All Files from the Save as type dropdown menu and
 proceed to click Save.
8 Execute the BAT file by double-clicking on it. This
 action will result in the formation of a new folder titled Private 
within the identical directory.
9 Transfer all the desired files and folders into the 
Private folder for secure storage.

  1. Double-click your batch file again once you've placed your files in the Private folder.
  2. In the command prompt window, input Y and press Enter.

Your folder should now disappear. To access it later, double-click the batch file and enter the password you set earlier. If you enter your password correctly, the private folder will reappear. 

 This BAT file used to lock the folder can be modified on your PC, meaning others familiar with this trick might be able to change your password. 

 

2. Lock the Folder Using 7-Zip 

A widely used desktop program called 7-Zip offers an alternative method to safeguard and compress your confidential documents on Windows. While its primary function is to unzip folders and extract files, 7-Zip also provides the capability to password-protect folders. Follow these steps to utilize this program effectively:

1. Begin by downloading and installing 7-Zip on your personal computer.
2. Access the 7-Zip File Manager application through the search menu.
3. Identify the specific file or folder that requires protection, select it, and click on the Add option located at the top of the window.
4. Enable the Delete file after compression checkbox.
5. Input your desired password within the Encryption section and proceed by clicking OK.


 Once you complete the steps above, your folder will be replaced by a ZIP file. To access its content, right-click your ZIP file and select 7-Zip > Extract Here. You'll then be prompted to enter your password. 

 While this method isn't particularly efficient, as you'll need to go through the entire process every time you need to add files, it works perfectly and relies solely on trusted software.

3. Use the Folder Lock App 

Installing a third-party tool can enhance your experience and provide you with advanced features. There are several reliable programs that can be used to secure folders on Windows. Among these options is Folder Lock, a highly recommended application that offers file and folder protection as well as the ability to lock USB or external storage drives. This tool is compatible with Windows 11, ensuring seamless functionality.


 Once the targeted folder is locked, you'll need to use the Folder Lock app to unlock it. This tool is free, but you can upgrade to the Pro version if you want to access its premium features.

Share:

Popular Posts

Blog Archive