Hello and welcome everyone. In today's article, you will learn how to lock folder and content in it.
Please be aware of few things:
- The method is shown here works, but you need to be careful and follow step by step or you will damage your files permanently,
- If you forget your password, you can not access your files anymore
- Your files altho protected can still show up in recent files of some applications
All of that being said, let us start with locking the local folder on the computer with the password.
Go to the folder where you have files that you would like to hide and lock with a password. Enter the folder and create the new text file inside it. Skip the name for now and go inside it. Copy and paste the following code inside the file:
cls
@ECHO OFF
title Folder Locker
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
Now locate this line of code in the document: if NOT %pass%==Your-Password-Here goto FAIL and replace Your-Password-Here with your password.
!!! Write down somewhere your password, if you lose it you will lock the folder even for you !!!
Save the file as FolderLocker.bat and double-click on it to execute it.
If everything was done correctly, a new folder with the name: Locker
Move files that you want to hide and protect inside that folder.
Double click again on FolderLocker.bat
The command prompt will appear with the question do you want to lock the folder, press Y, and press ENTER. The command prompt will close and the Locker folder will disappear.
In order to unhide and access the folder, you will need to double click on FolderLocker.bat again but this time command prompt with ENTER your password will appear. Type in your chosen password and the folder is back. If you wish to hide and lock it again just double click on FolderLocker.bat again, confirm with Y and it is hidden again.