FileWhopper Blog

News and Perspectives from IT Experts
August 16, 2021
FileWhopper

How to Lock a Folder with a Password in Windows 10

Do you know how to protect your sensitive files on a Windows 10 computer? Place them in a folder locked with a password. Read this guide to learn how to do so.

Are you concerned about the security of sensitive files on your Windows 10 computer? If yes, you may want to consider placing them in a password-protected folder. This way, you can keep prying eyes from gaining access to them. Don’t worry – you won’t require any third-party software tool to create such a folder.

Note that the first method presented here can be bypassed by tech-savvy individuals. It involves using a batch script to lock a folder. However, it will still serve to dissuade some nosy friends and family members who have access to your PC from viewing files you’d rather keep private.

For those using Windows 10 Pro or Enterprise, we’ll also look at how to encrypt your files using BitLocker.

How to Easily Protect a Folder with a Password in Windows 10

To be on the safe side, use an unimportant folder to first try out the instructions outlined below in case you run into a problem.

Without further ado, let’s begin:

  1. You can create a new folder or use an existing one that contains the files you want to protect.

Here is how to create a new folder:

  • Press the Windows logo key + E to open File Explorer.
  • On the left side of the window, click on Desktop, Downloads, Documents, or any other location you prefer.
  • Right-click on a blank area on the right side of the window and select New > Folder.
  • Now, open the folder and right-click on a blank area. Select New from the context menu.
  • Select Text Document and press Enter.
  • Double-click the newly created text document to open it and then copy and paste the following 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%==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

  • Go to the line that says “if NOT %pass%==Your-Password-Here goto FAIL.” Delete “Your-Password-Here” and type in any password of your choice.

Note: The password you choose will be used to protect your folder. Make sure the characters do not include a space, as that can cause an issue with the batch file. Also, make sure you note down the password. Should you forget it, you won’t be able to recover your files.

  • Now, click the File tab and select “Save As”.
  • Type “Lock.bat” under “File name:”. Actually, you can use any name of your choice, but make sure you add the .bat extension.
  • Select “All Files” under “Save as type:”
  • Click the Save button.
  •  Now, double-click the newly created BAT file to generate a folder named Locker.
  •  Move the files you want to protect into the Locker folder.
  •  Double-click the BAT file again and type Y into the command prompt that opens. Then press Enter. Doing so activates your password, and the Locker folder becomes hidden.
  •  To access the files which you placed inside the now hidden Locker folder, double-click the BAT file and type in the password you chose in Step 5. Press Enter.
  •  To hide the folder again, repeat Step 5.

There you go. The method is pretty straightforward, right?

There is a loophole you should take note of: after you use a program, such as Microsoft Word, to view a file placed in the password-protected Locker folder, the file will be in the program’s Recent Files. This means that someone else can gain access to it from there. 

Set Up a Virtual Disk and Enable BitLocker

Windows 10 comes with BitLocker Drive Encryption. The feature enables you to scramble data on your PC’s hard drive or removable drives, making it unreadable to anyone who does not have the encryption key. Even if you share the data with other people, they won’t be able to read it without authorization.

Keep in mind that BitLocker is only available on Windows 10 Pro and Windows 10 Enterprise. Using it to password-protect your sensitive folders is not complicated. Simply follow the procedure presented below.

Create a Virtual Hard Disk (VHD)

Follow these steps to create a virtual hard disk:

  1. Go to the Start menu. You can do this by pressing the Windows logo key.
  2. Type Disk Management into the search bar and click on it from the results.
  3. Go to the Action tab and select Create VHD from the context menu.
  4. Click the Browse button and select a location to store the VHD.
  5. Enter a name for the drive (for example, Secure_vault) and click the Save button.
  6. Under the “Virtual hard disk size” category, you have to indicate the number of gigabytes to reserve for storage. It should be enough to contain all the files you want to protect.
  7. Select VHDX under the “Virtual hard disk format” category. This step is optional.
  8. Select Dynamically Expanding to allow the storage to increase as you save files.
  9. Click the OK button and then right-click on Disk x.
  10.  Select Initialize Disk and mark the new Disk x.
  11.  Select the Master Boot Record (MBR) option.
  12.  Click the OK button.
  13.  Right-click Unallocated Space and select New Simple Volume. Then click the Next button.
  14.  Leave Volume Size at its default settings and click the Next button.
  15.  Expand the “Assign the following drive letter”drop-down and choose a letter for the new drive.
  16.  Click the Next button.
  17.  Click the File system drop-down and select NTFS.
  18.  Select Default under the “Allocation unit size” drop-down.
  19.  Enter a descriptive name (e.g. Secure_vault) for the drive in the Value label field.
  20.  Mark the option that says “Perform a quick format.
  21.  You can deactivate the “Enable file and folder” option if necessary.
  22.  Click Next > Finish.

After completing the above steps, you now have a virtual hard disk that can be password-protected with BitLocker. The disk can store all your important files.

How to Enable BitLocker

Now, follow the steps below to activate BitLocker on your virtual hard disk:

  1. Press the Windows logo key + R on your keyboard to invoke the Run dialog.
  2. Type Control Panel into the text box and click OK or press Enter.
  3. Go to System and Security. You can use the search bar to find it.
  4. Click on BitLocker Drive Encryption.
  5. Under “Fixed data drives”, select the virtual hard disk you created and then click “Turn on BitLocker.”
  6. Mark the option that says “Use a password to unlock the drive” and type in a password.
  7. Click the Next button > Save to a File.
  8. Select a location in which the recovery key text file will be stored.

Note: If you lose the recovery key and forget your password, you won’t be able to recover your files. It’s therefore very important that you store the text file in a safe place.

  • Click the Save button > Next.
  •  Select the option that says “Encrypt used disk space only.”
  •  Click the Next button.
  •  Select Compatibility Mode and then click the Next button.
  •  Click on Start Encryption. Once the process is complete, click the Close button.

Once you’ve completed the above procedure, you now have a password-protected virtual disk that you can use as a folder to protect your sensitive files.

How to Unlock the Virtual Drive and Access Your Files and Folders

Follow these steps to unlock the drive and view your protected files and folders:

  1. Press the Windows logo key + E to open File Explorer.
  2. Go to the location where you stored your virtual hard disk file.
  3. Double-click it to get it mounted to File Explorer.

Note: You will get a message that says “Access Is Denied” or “Not Accessible.” There is no need to worry. This is because you have mounted the drive but have not provided the password.

  • On the left pane of File Explorer, click on This PC.
  • Now, double-click the drive under the Devices and drives section. The sign-in page will come up.
  • Enter your password to unlock the virtual drive and access your files.

Tip: If you happen to forget your password, click the More Options link and select Enter Recovery Key. Now, type in the 48-digit recovery key as presented in the text file you saved while enabling BitLocker.

  • Click the Unlock button.

How to Lock the Virtual Drive

After you are done going through your files, you have to lock the drive once again. Here’s how:

  1. Press the Windows logo key + E to open File Explorer.
  2. Go to This PC.
  3. Under the Devices and Drives category, right-click on the BitLocker-enabled virtual drive and click Eject.

One great advantage in using a virtual hard disk with BitLocker to protect your private folders is that your files will always need to be unlocked using the procedure indicated above before they can be accessed.

There you have it. Now that you know how to use password protection for folders in Windows 10, you should take the extra step and make sure your files remain safe when you need to share them online. We recommend FileWhopper, a service that allows you to quickly and safely transfer files and folders of any size on a pay-as-you-go basis. FileWhopper protects your data with military-grade zero-knowledge encryption, ensuring that no one, except for you and your recipient, can access it. Check it out today and give yourself the peace of mind you deserve.

Did you like this article?
1 Star2 Stars3 Stars4 Stars5 Stars
loading...Loading...
Share it
Scroll up