How Do I create a Password Protected Folder in Windows 11?

5/5 - (20 votes)

Are you searching for how to create a password protected folder in Windows 11 then you’re on the right page?

Today, In this post, we’ll show you step-by-step methods to set the password for any folder so that you can protect your private files from the world. But the problem is that not everyone knows how to password protect a folder in Windows 10. 

There are tons of folder lock software available on the internet through which you can protect your folder from hackers. But few of them know that in Windows 10, you can set a folder password without installing any third-party software. 

At the end of this article, you’ll be able to lock and hide your important folder in your Windows laptop. 

So without any ado, let’s get started.

Note: For your safety, you should first try this method using files that you can afford to lose, just in case the folder lock method doesn’t work for you. Also, make sure you’re keeping your files safely somewhere, of the exact password you’re using to lock your folder. If you lose the password, your files are gone.

How Do I create a Password Protected Folder in Windows 11

Follow the following step carefully to create a password protected folder in your laptop.

➡️ Right-click inside the folder that you want to protect with a password. Your all files should be inside that folder which you want to secure. For example, In my case, I’ve a folder named “FolderLocked” and we want to hide and lock this folder.

how to lock a folder in Windows 11
Right-Click Inside the Folder That You Want To Password Protected

Also Read: How to Activate Windows 7 Without Any Product Key

➡️ Select “New > Text Document” from the contextual menu.

create text file
Create a Text Document File

➡️ Once you click a text document, a text file (New Text Document) will be created inside the folder that you want to hide and lock with a password.

new text document
New Text Document Created

➡️ Re-name the “New Text Document” file according to your name choice. I’m naming it “LockedFolder”.

re-name new text document folder
Re-Name New Text Document
Note: It doesn't matter what the file will be named. You can delete this text file once the lockable folder has been made.

➡️ Double click on the “LockedFolder ” text file that we’ve re-named in the previous step. A notepad file will be opened in front of you.

open notepad file
Double Click on Notepad file to open it

➡️ Copy the given below code.

if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Private goto MDPrivate
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.
ren Private "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
echo Enter password to Unlock Your Secure Folder
set/p "pass=>"
if NOT %pass%== YOUR-PASSWORD goto 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
echo Invalid password
goto end
md Private
echo Private created successfully
goto End

➡️ Paste the code into the “FolderLockednotepad file that you copied in the past step.

folderlocked bat code
Paste the Copied code inside the LockedFolder Notepad file

➡️ Now, On the notepad text file (LockedFolder), you have to find the “ if NOT %pass%==YOUR-PASSWORD goto FAIL” and replace YOUR-PASSWORD with the password that you want to protect your folder with. In my case, I’ve used “Blogger” as my password.

protected password
Replace YOUR-PASSWORD with your password that you want to protect your folder.

➡️ In my case, I’ve used “Blogger” as my password.

folder lock password set
I’ve set Blogger as a password

➡️ Click File > Save as.

save as notepad file
Save Notepad file

➡️ Click on the “Text Documents (*.txt)” menu bar that’s next to “Save as type” and Select “All File“.

select all files type

➡️ Change the file name to “FolderLocker.bat” and hit “Save” button.

Save file as FolderLocker.bat

➡️ When you click “Save” a FolderLocker.bat Windows batch file will be save inside that folder that you want to password protected.

FolderLocker windows batch file
FolderLocker Windows Batch File

➡️ Double-click FolderLocker and a new folder named “Private” will be created automatically.

private folder created automatically
Private Folder Created Automatically

➡️ Move all the files inside the “Private” folder that you want to hide and protect with password.

protect all file with password
Move all files inside the Private Folder

➡️ Now it’s time to set folder password. To do this double click on the “FolderLockerwindows batch file, a command prompt window will open in front of you that will ask “Are you sure you want to lock this folder?”. You have to type Y and hit enter key from your keyboard.

type Y in command prompt
Type “Y” in the Command Prompt and Hit Enter.

➡️ When you press enter, the private folder will be automatically hidden, and only FolderLocker Windows batch file will be visible to you. You’ve successfully hide the private folder. 

folder has been hidden
Private Folder Has Been Hidden

➡️ To open your password protected folder, double click on the FolderLocker.bat Windows batch file. A command prompt window will open asking you the password that you’ve created in the previous step. Type your password and hit enter. Once you do that, your hidden folder will be displayed to you successfully.

to unhide the folder type password
To Open Hidden Folder Double Click on FolderLocker.bat file

➡️ Once you hit enter after entering the password, your private folder will be visible to you.

private folder visible

Now, if you want to hide your private folder again, all you need to do is double click on the FolderLocker.bat Windows batch file again. 

So, that’s how you can easily hide and protect your private files without using any third party software. However, this is the best idea for free folder lock in Windows PC.

I hope you’ve successfully locked and hidden a folder in Windows 11 without Installing third party software. 

Note: If you want to hide and lock folder in Windows 10 as well, then you can follow the same method. This method is also working for Windows 10 operating system. 


I hope this method is helpful for you to hide and lock the folder in Windows 11. Well, if you’re using Windows 8.1 then you can also create a Password Protected Folder in Windows 8.1. You can upgrade your Windows 8.1 to Windows 11.

You Might Also Like This:

Sharing Is Caring:

Leave a Comment