ChampagneWiki.
General Resources

Lock & Hide Folders

Ever wanted to lock and hide your windows files and folders behind a password? The windows hide option is just not secure enough? Worry not!

System Enclave

Lock & Hide Folders.

The default Windows "Hidden Items" option is not secure. Deploy this automated script to create a truly encrypted, password-protected local locker.

FolderLocker.bat
> attrib +h +s Locker

Follow these steps to create an executable batch file that acts as a secure, password-protected gateway to your hidden folder.

Copy the code snippet provided at the bottom of this page. Open Notepad (or any text editor), paste the code, and save the file to your desired location.

Important: When saving, name the file FolderLocker.bat (make sure to include the .bat extension, not .txt).

Right-click your new .bat file and select Edit. Locate the following line in the code: if NOT %pass%==Your-Password-Here goto FAIL

Replace Your-Password-Here with your own highly secure password. Press Ctrl + S to save your changes.

Double-click the .bat file. A command prompt will briefly flash, and a new folder named Locker will appear in the same directory.

Move any sensitive files, documents, or sub-folders into this newly created Locker folder.

Double-click the FolderLocker.bat file again. A terminal window will ask: Are you sure u want to Lock the folder(Y/N)

Type Y and press Enter. The Locker folder will instantly disappear from your directory.

To access your hidden files again, double-click the FolderLocker.bat file.

  • It will prompt you for the password you set in Step 2.
  • Input your password and press Enter.
  • The Locker folder will reappear, granting you full access to your files!

How Does This Work?

This script utilizes a clever Windows CLSID (Class ID) trick. When you lock the folder, it renames the directory to Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D} and applies hidden system attributes. Windows immediately interprets this folder as a system Control Panel shortcut, effectively vanishing it from standard view and making it inaccessible without the script to reverse the process.


Copy the entirety of this code block to create your batch file.

FolderLocker.bat
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

On this page