A lightweight Windows Batch Script to lock and unlock folders with a password.
This script disguises your folder as a Control Panel shortcut and hides it using system attributes, making it inaccessible without the correct password.
- Automatically creates a private folder (
Private) if it doesn’t exist. - Lock the folder by renaming it into a Control Panel shortcut.
- Hide the locked folder with system attributes (
+h +s). - Unlock the folder with a password prompt.
- Simple password check to prevent unauthorized access.
- No external software required—just native Windows batch scripting.
- Save the script as
locker.bat. - Run the script:
- If the folder is unlocked, you’ll be asked whether to lock it.
- If the folder is locked, you’ll be prompted for a password to unlock it.
- When locked:
- The folder is renamed to
Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}. - Hidden and system attributes are applied.
- The folder is renamed to
- When unlocked:
- The folder is restored to
Private. - Attributes are removed.
- The folder is restored to
- Open the script in a text editor.
- Replace
YOUR-PASSWORDwith your desired password.if NOT %pass%== YOUR-PASSWORD goto FAIL