How to Password Protect and Hide Folder in Windows 11

How to Password Protect and Hide Folder in Windows 11

Lock any folder or software with passwo

Any folder on your Windows computer can be locked with a simple Notepad hack. You can hide a folder and require a password before it is visible and accessible by creating a batch file. This is a great tool for locking sensitive information, such as photographs and financial statements.

Firstly, you will need to create a batch file using Notepad inside the folder you wish to secure. From the right-click menu, choose New > Text Document.

explorer_n3wMJON6S4.png

Add the following code to your Notepad document.

@ECHO OFF
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Private goto MDPrivate
:CONFIRM
echo Are you sure to lock this 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 Private "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 Your Secure Folder
set/p "pass=>"
if NOT %pass%== passwordgoto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDPrivate
md Private
echo Private created successfully
goto End
:End

Notepad_TytF63opIk.png

The pasted text allows you to change the name of the locked folder, as well as the password required for unlocking it. "Private" is the default folder name, and "password" is the default password.

Here, I will change the folder name and password.

Notepad_C21gqbNIsz.png

If you want to save the file as anything else besides ".bat," just make sure to put .bat at the end and select "All files" when you save the file. In addition, if you opened Notepad directly rather than right-clicking, be sure to change the location in which you save the document.

explorer_WdJw8uDocj.png

explorer_Nz9P0zoUM9.png

Double-click the batch file (or select and hit Enter) once you're ready to lock the folder, then choose 'y' from the window that appears and press Enter. The folder should now disappear.

explorer_iLGRS8KcO1.gif

Whenever you need access to your folder, simply double-click the batch file, enter your password, and hit Enter. Just hit the batch file again to re-lock (and hide) the folder. Don't forget, the batch file can be named however you like, and you are free to use this trick in several locations on your Windows PC to make sure it works.