🔒 How to Create a Hidden Locker Folder Using a Batch File



Ever wanted to hide your personal files without installing third-party software? 🤔 A simple batch script can do the trick! In this blog, I'll explain how a Lock.bat file works, allowing you to create a hidden folder, store your files, and lock them away securely. Let's dive in! 🚀


📌 What Does the Lock.bat File Do?

This batch file acts as a locker system:
✅ When you double-click, it creates a folder named Locker 🗂️.
✅ You can store files inside this folder.
✅ Double-click again, and the Locker disappears! ✨
✅ Even if you enable "Show Hidden Files", the folder remains invisible! 😲
✅ Enter your password to unlock and retrieve your files 🔓.


🔍 Breakdown of the Batch Code

Now, let's understand how this script works, step by step:

1️⃣ Checking If the Folder Exists


if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK if NOT EXIST Locker goto MDLOCKER
  • If a hidden "Control Panel" folder exists, it means the folder is locked. The script jumps to UNLOCK 🔓.
  • If the Locker folder doesn't exist, it creates one (MDLOCKER) 📂.

2️⃣ Creating the Locker Folder

:MDLOCKER
md Locker echo Locker created successfully goto End
  • If no folder is found, it creates a folder named Locker 🏗️.

3️⃣ Locking the Folder

: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
  • Asks the user: Do you want to lock the folder? (Y/N) ⌨️
  • If "Y" is entered, it goes to LOCK 🔐.

4️⃣ Hiding the Folder

: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
  • Renames the "Locker" folder to "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}".
  • This makes the folder invisible by disguising it as a Control Panel shortcut ⚠️.
  • Applies hidden (+h) and system (+s) attributes, making it harder to find 👀.

5️⃣ Unlocking the Folder


:UNLOCK echo Enter password to Unlock folder set/p "pass=>" if NOT %pass%==type 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
  • Asks for a password 🛑.
  • If correct, it removes the hidden attributes and renames the folder back to "Locker" 🎉.
  • If incorrect, it shows an error message (FAIL) ❌.

6️⃣ Handling Incorrect Passwords


:FAIL echo Invalid password goto end
  • If the wrong password is entered, it displays an error and does not unlock the folder.

🛠️ How to Use This Batch Script?

1️⃣ Copy the above code into Notepad.
2️⃣ Save as Lock.bat (make sure to select "All Files" as the file type).
3️⃣ Double-click Lock.bat to create the Locker folder.
4️⃣ Place your files inside the Locker folder 🗂️.
5️⃣ Double-click again → Type Y → The folder will disappear! 💨
6️⃣ To unlock, double-click again, enter your password, and the folder reappears! 🎩✨


⚠️ Important Notes

🔹 This is a basic security trick, not an encryption tool.
🔹 Anyone familiar with batch scripts can open Lock.bat and view your password.
🔹 Use this method only for casual file hiding, not for sensitive data 🛡️.


⚠️ Complete Batch code (Copy and paste for your .bat file)

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%==type 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

🤔 Final Thoughts

This simple batch file is a great way to hide your files quickly without extra software! If you found this helpful, let me know in the comments! 🚀💬

Comments