How to Lock Folder in Windows 10 (Password Protect Folder)

Almost every one of us has important or not-so-important files that we like to hide and protect from others. In fact, using the attrib command you can hide folder in such a way that it will not be visible even if someone tries to unhide folders using regular methods. Apart from that, there are several ways you can lock folder and password protect it. Below are some of the easiest methods you can use to lock folders or even drives in Windows 10.

Jump to:

1. Use Batch File to Password Protect and Lock Folder in Windows 10

The simplest way to lock a folder in Windows is to use a batch file. All you have to do is add the all the contents you want to lock away in the folder created by the batch file, lock the folder and the batch file will completely hide it from the plain sight. When you need access, you have to enter the password in the batch file to reveal the folder.

This method is perfect for hiding and protecting not-so-important files that you don’t want others to see. Simply follow the below steps and you should have a working batch script to lock folder in Windows.

Warning: This method is not a secure way to protect your files and folders. Anyone with a little knowledge about bat files or know where and how to look can unlock the content. To secure important files and folders, I’d recommend following the 3rd method.

1. Open the File Explorer and go to the drive or folder where you want to store the locked folder. In my case, I’m selecting a folder called WindowsLoop in my D drive.

2. The first thing we need to do is create a batch script. You can do that with a regular text file. So, right-click in the File Explorer and select “New -> Text Document”.

Win10 lock folder with password 01

3. Rename the text file to lock.bat. You can name the file anything you want. Just make sure that the file extension is .bat, not .txt.

Win10 lock folder with password 02

4. Right-click on the newly created file and select the “Edit” option. This action will open the batch file in the Notepad. In the Notepad, copy and paste the below code.

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%==ENTER_YOUR_PASSWORD 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

5. In line 23 of the pasted code, replace “ENTER_YOUR_PASSWORD” with the actual password that you’d like to lock the folder with.

6. After entering your own password, select “File -> Save” to save the batch file changes. Close the file after saving.

Win10 lock folder with password 04

7. Now, double-click on the lock.bat file.

Win10 lock folder with password 05

8. You will be prompted for a password. Type the password you’ve added in the batch file and press Enter.

Win10 lock folder with password 06

9. As soon as you press the Enter button, you will see a new folder called Locker in the same folder as the batch file.

Win10 lock folder with password 07

10. You can save any number of files or folders in the Locker folder. As you can see from the image below, I’ve stored my super secret folder in the Locker folder.

Win10 lock folder with password 08

11. Next, execute the lock.bat file again. You will be asked whether you’d like to lock the folder. Type Y and press Enter.

Win10 lock folder with password 09

12. Just like before, the folder is completely hidden from the plain sight.

Win10 lock folder with password 10

If you want access to the locked folder, execute the batch file again, enter the password and you will see the locked folder.

2. Encrypt and Password Protect Folders Using NTFS Advanced Permissions

Note: You need to be using the Pro version of Windows. Moreover, the file system should be NTFS.

Windows 10 lets you natively encrypt a folder contents with your user account password. Since Windows uses your user account to encrypt the folder, other users on your system cannot access the contents of the encrypted folder. Only you can access the folder by logging to your user account. If your system only has a single user account then create another one for other users and change the password for your user account so that only you can log into your user account.

1. First, check that the folder you want to protect is located in an NTFS formatted drive. To do that, right-click on the drive and select “Properties”. You will see the drive file system next to “File System”. It should be saying “NTFS”.

Win10 lock folder with password 11

2. Now, create a folder in the NTFS drive. Now, right-click on the folder and select the “Properties” option.

Win10 lock folder with password 12

3. In the folder properties window, click on the “Advanced” button.

Win10 lock folder with password 13

4. Now, select the checkbox “Encrypt contents to secure data” and click on the “Ok” button.

Win10 lock folder with password 14

5. Click on the “Apply” and “Ok” button in the main folder properties window.

Win10 lock folder with password 15

6. As soon as you apply the changes, you will see a notification to back up the private key. This is not essential. However, backing up allows you to recover data stored in the encrypted folder if you lose access to your user account. Click on the “Notification”.

Win10 lock folder with password 16

7. To back up the private key, click on the “Back up now” option and follow the wizard. Once you are done backing up, you should see the key file in your Documents folders. Follow the next steps after completing the backup.

Win10 lock folder with password 17

8. Now, copy the files and folders you’d like to lock up. Files added to the encrypted folder have a little lock icon. Since the folder is encrypted by your user account, you can use the encrypted folder like any other folder.

Win10 lock folder with password 18

9. If any other user from other user accounts tries to access the contents of the encrypted folder, they will be greeted to an error message something like the below one.

Win10 lock folder with password 19

Do keep in mind that this method is certainly better than the first one, however, it still is not perfect. So, don’t store important files using this method. That being said, it still is a good method to lock not-so-important files that you don’t want others to see.

3. Use  BitLocker to Encrypt, Password Protect, and Lock Folders in Windows

Windows 10 Pro version has a built-in powerful encryption tool called BitLocker. You can use the BitLocker tool to encrypt entire drives. Once encrypted, it is almost impossible to get access to the contents of the encrypted drive without proper authorization. To encrypt a drive using BitLocker follow the below steps.

1. Open the start menu, search for “Manage BitLocker” and open it.

Win10 lock folder with password 20

2. The BitLocker Management screen will list all the available drives. Find the drive you want to encrypt and click on the “Turn BitLocker On” link next to it.

Win10 lock folder with password 21

3. You will be asked to choose the authentication type. In my case, I’m selecting the password authentication. So, select the “Use a password to unlock the drive”, enter your password, and hit the “Next” button.

Win10 lock folder with password 22

4. For recovery purposes, you will be asked to back up the recovery key. Click on the “Save to a file” option.

Win10 lock folder with password 23

5. Select the destination where you’d like to save the recovery key. In my case, I’m select the desktop. Keep this file safe and secure so that if you ever forgot the BitLocker password, you can use this file to decrypt the drive and access the contents.

Win10 lock folder with password 24

6. In the BitLocker wizard, select “Encrypt used disk space only” and click on the “Next” button.

Win10 lock folder with password 25

7. Select “Compatible mode” and click “Next”.

Win10 lock folder with password 26

8. Click on the “Start encrypting” button. Depending on how much data there is in the drive, it can take some time to complete the encryption process. So, it back and wait.

Win10 lock folder with password 27

9. Once the drive is encrypted, you will see a lock icon on the drive icon in the File Explorer. You can use it as your regular drive.

Win10 lock folder with password 28

10. Every time you log into your system, you will see a locked drive. To unlock the drive, double-click on it.

Win10 lock folder with password 29

11. You will be prompted to enter the BitLocker password. Enter the password and the drive will be unlocked and decrypted so that you can use it like any other drive.

Win10 lock folder with password 30

That is it. It is that simple to encrypt drive with BitLocker in Windows 10. If you looking to protect important files and folder, this is the method you should be using.

Lock Folder in Windows 10 – Conclusion

As you can see, there are multiple ways to protect files and folders with a password in Windows 10. Use the first method for files that you’d like to hide from the plain sight. Use the second method for not so important files but you’d still like others not to access them easily. For important files like your financial documents, personal media, etc., use the BitLocker method. The BitLocker method is the most secure of all three and as long as you use a good password, it is almost impossible to access the contents of the BitLocker encrypted drive without proper authentication.

If you like this article, do check how to enable Windows defender sandbox and how to enable Windows 10 sandbox to run applications in a sandboxed environment.

Leave a Comment

Scroll to Top