Visit Website

How to Lock Any Folder with Password Using CMD & BAT File in Windows 10/11

Learn how to lock any folder with password using CMD and BAT file in Windows 10/11. Easy step-by-step folder locker guide without software.

If you want to protect your personal files without installing any software, you can create a password-protected folder using a simple BAT file in Windows.

This trick uses CMD commands and works on both Windows 10 and Windows 11.

Follow this step-by-step guide carefully.


📌 What Does This Trick Do?

This BAT file will:

  • Create a hidden folder

  • Lock the folder with password

  • Hide files from normal users

  • Unlock folder using password

No third-party software is required.


⚠️ Important Note

This is a basic folder protection trick for personal use.

✔️ Good for:

  • Hiding private files

  • Basic protection

❌ Not recommended for:

  • Highly sensitive data

  • Professional security needs


💻 Step 1: Open Notepad

  1. Press Windows Key

  2. Search for:

Notepad
  1. Open it


🧩 Step 2: Paste the BAT Script

Copy and paste the code below into Notepad:

@echo off
title Folder Locker
color 0A

if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Locker goto MDLOCKER

:CONFIRM
echo.
echo Are you sure you want to lock the folder? (Y/N)
set /p cho=

if /I "%cho%"=="Y" goto LOCK
if /I "%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.
echo Folder Locked Successfully!
pause
goto END

:UNLOCK
echo.
echo Enter password to unlock folder:
set /p pass=

if NOT "%pass%"=="1234" goto FAIL

attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker

echo.
echo Folder Unlocked Successfully!
pause
goto END

:FAIL
echo.
echo Invalid Password!
pause
goto END

:MDLOCKER
md Locker

echo.
echo Locker folder created successfully!
pause
goto END

:END
exit

💾 Step 3: Save as BAT File

  1. Click File → Save As

  2. File name:

locker.bat
  1. Select:

Save as type: All Files
  1. Click Save


▶️ Step 4: Run the BAT File

  1. Double-click locker.bat

  2. A folder named:

Locker

will be created.

  1. Put your files inside the folder.


🔒 Step 5: Lock the Folder

  1. Run locker.bat again

  2. Press:

Y
  1. Folder will become hidden and locked.


🔓 Step 6: Unlock the Folder

  1. Run locker.bat

  2. Enter password:

1234
  1. Folder will unlock successfully.


⚙️ How to Change Password

Find this line:

if NOT "%pass%"=="1234" goto FAIL

Replace:

1234

with your own password.

Example:

if NOT "%pass%"=="mypassword" goto FAIL

🚀 Benefits of This Trick

  • No software required

  • Easy to use

  • Lightweight

  • Works offline

  • Beginner-friendly


⚠️ Important Tips

  • Remember your password

  • Keep BAT file safe

  • Do not delete the BAT file

  • Use stronger password for better security


📝 Final Words

Using CMD and BAT files to lock folders is a simple and fun Windows trick for protecting personal files. It is lightweight, easy to create, and works without extra software.

For better security, always use a strong password and keep backups of important data.

For more Windows tricks and coding guides, visit CodeSardar.


❓ Frequently Asked Questions

Q1. Is this method completely secure?
It provides basic protection but is not military-grade security.

Q2. Can I change the password?
Yes, edit the BAT file and replace the default password.

Q3. Does it work on Windows 11?
Yes, it works on both Windows 10 and Windows 11.


Download Bat File

📥 Download

Complete Video Guide/Tutorial


Post a Comment

Have a question or feedback? Share it below! Please avoid spam and stay respectful.
Visit Website
Visit Website