Hello friends, my last two blogs in this category were about How to hide the Folder using Command Prompt, that was done by changing the attributes of the file or the folder. And changing the folder icon to the system icon, using the hex codes of the system folders. This article is to protect the data with the password.
Protect your data with a password:
Many of us install third party software to protect the data with a password. But in this article, we will learn how to protect our data folder with the password using batch files. This is very easy method of locking and hiding folders in Windows without any additional software.
Follow these steps:
1. Open a text file on notepad and save it as lock.bat
2. Add these following lines to the notepad file
cls
@echo off
title Folder Locker by techfanas
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%==techfanas 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
3. Save the above code.
4. When you double click or run the Lock.bat file, it will create a new folder named “Locker” automatically, if it is not created. Just copy all the sensitive and important data to this folder.
5. If the folder named “Locker” is created and visible, then it will ask to lock the folder.
The folder named Locker will be locked with the password and invisible.
6. To unlock the folder double click on the batch file named lock.bat, it will asked for the password. Enter the password as techfanas and the folder will be visible and unlocked again.
you may change the password, just replace the techfanas with your password in the above code.
This trick uses both the trick used in my previous articles of this section.
Note:
- The default password for the folder named Locker is “techfanas”. You may change this password to your desired password. Just replace the techfanas in the code of the lock.bat file and save that file.
- The directory of the batch file and the folder should be same i.e. the batch file and the folder should be in the same directory.
- Do not put the batch file with the folder after locking it because anyone can unlock it using the batch file and can get your password by editing the batch file. After locking the folder just move the batch file to another location.
- If you forgot the password in any case, just create another batch file with different password. That will also work well.



