How to Password Protect a Folder in Windows
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.
- Double-click your batch file again once you've placed your files in the Private folder.
- 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.
Post a Comment