How to Lock a Folder in Windows 10?

Andrew Moore
Updated: January 25, 2023

Everyone has secrets to protect. What could be better than a locked personal folder for your mysteries? Such a folder allows you to store a file with passwords to all accounts and emails, private photos, important work documents, and much more. We will tell you how to set a password for a personal folder in Windows 10.

How to Lock a Folder in Windows 10?

Access rights in Windows

Using this method, you can restrict access to a folder, any file, or even an entire disk partition. If you have several user accounts on your computer and you are a computer administrator, you can block access to the necessary information for everyone except for yourself. To do this, follow these steps:

  1. Right-click on a file, folder, or drive and select Properties.
  2. Go to the Security tab.
  3. In the list of accounts with access to the file, select the accounts you want to forbid access to the file or folder and check all the boxes in the Deny column.

Once these actions are done, a folder or disk partition becomes inaccessible to all users who do not have access rights. They cannot open it because it is necessary to enter the password for the administrator account, i.e., your account. Don’t forget to give the file or folder an inconspicuous name, as the file names will still be visible to anyone.

A special script

Go to any directory on your computer where you would like to place a folder with a password and right-click on any free area. Select “Create” — “Text document.” Choose any name for the document (this will have no effect later).

Open the created text file and insert the following code there:



title Folder Private

if EXIST “Compconfig Locker” goto UNLOCK

if NOT EXIST Private goto MDLOCKER


echo Are you sure you 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.



ren Private “Compconfig Locker”

attrib +h +s “Compconfig Locker”

echo Folder locked

goto End


echo Enter password to unlock folder

set/p “pass=>”


attrib -h -s “Compconfig Locker”

ren “Compconfig Locker” Private

echo Folder Unlocked successfully

goto End:FAIL

echo Invalid password

goto end:MDLOCKERmd Private

echo Private created successfully

goto End


This code is a script allowing you to set a password to a folder in Windows without any additional programs. Now you have to configure the password to access the secret folder. To do this, find the PASSWORD_GOES_HERE words in the code (highlighted above) and type the password for future access to your personal folder instead.

Once the password is set, save this file in a specific format. Click “File” — “Save as…“. Select “All files” in the window and type the desired name with file names but with the .bat extension. After that, click “Save.”

Now go back to the folder where the text document was created. You will see a file with the selected name and the .bat extension. If your computer is not configured to display file extensions, check the box in the selected folder in the “View” tab of the menu with file name extensions.

Run the created file by double-clicking on it with the left mouse button. A new folder named Private will be made.

All files you want to hide from other people can be placed in the new Private folder. After that, double-click on the created file with the .bat extension. You will see a system window with the “Are you sure you want to lock the folder (Y/N)” message. This way, the script asks you if you want to lock a folder. Type Y in the window that opens and press Enter on your keyboard. The Private folder will disappear.

To open it again, click on the file with the .bat extension. It will show the ‘Enter password to unlock folder” this time. After entering the password, press Enter, and the folder will appear again.

An archiver

This method allows you to password-protect a folder or file. You must have at least one archiver, such as WinRAR, installed on your computer. Then you can hide a secret file or folder in an archive and password-protect it. To do this, follow these steps:

  1. Right-click the file or folder and select “Add to archive.” 
  2. In the window that appears, select “Store” in the “Compression method” field. This way, you won’t have to waste time unpacking the file when you open the archive. 
  3. Click the “Set password” button. 
  4. Enter the password, confirm, and press OK. 
  5. Click OK in the main window. An archive of a file or folder will be created. 
  6. Delete the original file or folder.

Now you must first open the archive to access the file or folder and enter the password you set when opening the archive. Do not forget about the inconspicuous names for folders. This method also allows you to set a password on any new archive in Windows.


This method is suitable for disks. It is available if you have Windows 7 Ultimate, Enterprise, Windows 8/8.1, or Windows 10. To password-protect a disk partition or flash drive, do the following:

  1. Right-click on the drive and select “Enable BitLocker.”
  2. Check the “Use the password to unlock the disk” box. Enter your password and click Next.
  3. In the next window, select “Encrypt the entire drive.”
  4. Click “Start encryption” and wait for it to finish.

The system will prompt a password when you try to access the disk.

Anvide Folder Lock

Anvide Folder Lock is probably the most famous software solution to lock a folder on your Windows 10 computer. The official website is the best way to download it. There is a regular version you need to install and a portable version.

Once the program is installed, you need to open it and click on the plus sign at the top left of the screen. Due to Anvide Folder Lock, the desired folder will disappear from your computer. You will need to enter the program again, click the open lock icon, select the directory in Windows 10, and enter the password to get it back. You can also enter a password to start the program to increase the security level. This will make it twice as difficult to access the folder.


Lock-a-Folder is a free, open-source program for setting a password on a folder and hiding it from Explorer or a desktop to prevent outsiders from accessing it. This utility is very user-friendly.

All you need to do is set the master password on the first startup and add the folders you want to lock to the list. The same procedure is used for unlocking:

  • Launch the program.
  • Select a folder from the list.
  • Press the Unlock Selected Folder button.

The program does not require any add-ons to install.


DirLock is another free program for setting passwords on folders. It works as follows: the “Lock / Unlock” item is added to the context menu of the folders after installation to lock and unlock them.

This item opens the DirLock program, where the folder should be added to the list, and you can set a password on it. But this program can refuse to work in Windows 10 Pro x64. There is also no official website for the program (only the developer’s contacts are in the About window). Still, the program can be easily found on many other websites on the Internet. Don’t forget to check the program for viruses and malware.