How to put a password on a folder – 3 ways

How to put a password on a folder: In some situations, the user needs put a password on a folder on the computer to prevent unauthorized persons from accessing their data. This is one way to keep files safe and is used to protect folders on a computer.

Your device may currently contain various confidential and private information that should not be left open if other users have access to this PC. For example, it can be banking information, financial documents, personal photos and videos, and so on.

Storing such data in the clear may lead to malicious actions by an attacker who has gained access to the device, or reveal your secrets and secrets in other cases. Therefore, you need to make a folder with personal or confidential information in Windows private in order to protect yourself from unpleasant situations even on your own computer.

Protecting a folder with a password is a basic security step. This is a virtual vault that encrypts any files or additional subfolders you need for security.

Users of the Windows operating system can put a password on a folder in several ways:

  • Set a password on a folder without programs using a batch file.
  • Using an archiving program.
  • Using a third-party program designed to hide and lock folders and files.

In this guide, you will learn how to password protect a folder in several ways to keep your files protected and hidden from prying eyes. Using the suggested methods, you can set a password for a folder in Windows 10 or Windows 11, or use these instructions in previous versions of the operating system: in Windows 7 and Windows 8.

Important note. Be careful about creating and storing a password for a hidden folder, because in some cases, if you forgot the password for a folder, then nothing will help you, and you will not be able to access the locked data.

How to put a password on a folder without programs

First, we will look at the method of how to put a password on a folder in Windows without using other software. In this case, you use a batch script to lock folders with a password of your choice.

With the help of a BAT file, we can hide a folder with a password on a PC. You will need to create a batch file and enter your password into it.

This method does not protect files from advanced users, but may be useful in some situations.

Go through the following steps:

  1. We will create a new folder to use as a virtual safe named “Locker”. This folder must be created in the location on the computer where you intend to store your files. This folder will be created automatically.
  2. Create a blank text document in the directory where the locked folder will be stored by right-clicking on an empty space and selecting New, then Text Document.
  3. Copy and paste the following code into the Notepad window:
chcp 65001


if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK

if NOT EXIST Locker goto MDLocker


echo Are you sure you want 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 Wrong choice



ren Locker "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 protected folder

set/p "pass=>"

if NOT %pass%==123 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


echo Wrong password

goto end


md Locker

echo Private storage created successfully

goto end


In this code, I translated the questions asked on the command line into Russian. You can download a sample of the finished BAT file from here. To edit the file, it is better to use a third-party text editor, such as Notepad ++, the built-in WordPad is also suitable.

  1. Now you need to set your password. Change the password in line:
if NOT %pass%==123 goto FAIL
  1. Replace the default password “123” with another password of your choice.
  2. Enter the “File” menu of the Notepad program, in the context menu, click “Save As”. Name the file whatever you want, for example “123vs” for more secrecy, because this name does not mean anything, and inexperienced users will think that this is some kind of service file. You can choose a different name for this file.
  3. In the “File type:” field, select “All files”, and then add the “.bat” extension to the file name.

Double-click on the created BAT file to create a “Locker” folder. This folder is for storing your data and will be locked with a password.

  1. Put your sensitive data in the “Locker” folder.
  2. After placing the files, double click on the “123vs.bat” file again.
  3. A command prompt will open asking “Are you sure you want to lock this folder? (Y/N)”.
  4. Type “Y” and press the “Enter” key.
  5. The “Locker” folder will disappear in this location.

To re-access your files, double click on the “123vs.bat” file. The command prompt window will prompt you for a password to unlock the protected folder.

If you enter your password correctly, the Locker folder will reappear in that location.

As a result, you were able to put a password on a folder in Windows 7, Windows 8, Windows 10, Windows 11 without using third-party programs.

Keep in mind that other users who are familiar with this trick can find out the password in this BAT file. However, in most cases, few people will guess about this trick, so you will get your secret safe to store important information.

You can somewhat offset this shortcoming by going to the trick. We will change the file extension, and an outsider will not know the original extension and will not be able, and will not guess how to change it correctly.

Do the following:

  1. Enter the folder options, and then enable the display of the file name extension by unchecking the “Hide extensions for known file types” checkbox.
  2. Right-click on the “123vs.bat” file, and select “Rename” from the context menu.
  3. Instead of the “.bat” extension, install any other one, for example, “.exe”, as it is more neutral.
  4. Agree to change the extension for this file.
  5. A file named “123vs.exe” will appear at the location, which will not be able to run, and the manufacturer of the application is not known.

To use the file for its intended purpose, reverse the operation of changing the file name extension to “.bat”. after that, you can open the hidden folder in the suggested way.

How to create a folder with a password on Windows using an archiver

When users search for an answer to the question of how to set a password for a folder in Windows, they find an easy way to solve the problem using an archiver program.

In order to lock and compress your confidential documents, you can use the popular programs 7-Zip or WinRAR. These applications are used to create archives, extract folders, and extract files.

Other than that, WinRAR or 7-Zip allow users to protect their folders with a password. This method works great and can be used on your PC to keep your files safe.

To learn how to make a folder with a password using the mentioned archivers, read the relevant articles on the site

After locking a folder in an archive, you can also hide it from view:

  1. Right-click on the file, select “Properties” from the menu that opens.
  2. In the “General” tab of the properties of this file, check the “Hidden” box in the “Attributes” section.
  3. Click Apply and then OK.

Your file should now be gone.

To view this file again, use, for example, this method:

  1. Press the “Win” + “R” keys.
  2. In the dialog box that opens, run the command – “control folders”.
  3. In the opened Explorer Options window, open the View tab.
  4. In the “Advanced options” section, activate the “Show hidden files, folders and drives” option.
  5. Click OK.

Now you have the opportunity to see the hidden file and open it after entering the password.

To make a file or folder hidden again, open the File Explorer Options window and select the “Don’t show hidden files, folders, or drives” option. If you no longer need to hide this element, then clear the Hidden attribute in the properties of this file.

Using Third Party Programs

You can use a third party program that allows you to protect files and folders with passwords. For example, the Wise Folder Hider program from the well-known developer WiseCleaner, which has a free version that you can use to hide folders and files on your computer.

In addition to hiding files and folders in the program, you can create an encrypted container file. File encryption in the free version of Wise Folder Hider is limited to 50 MB.

Do the following:

  1. At the first start, create a user password to enter the program.
  2. Drag files or folders into the program window to make them hidden.
  3. To gain access to files, you will need to open the Wise Folder Hider program by entering the password for this application.
  4. To remove a folder from the program, select the “Show Folder” option from the drop-down menu. After that, this folder will become available to everyone on the computer.

Article Conclusions

Sometimes, the user needs to put a password on a folder to hide information from strangers. You can implement this with simple methods: hiding the folder using a BAT file, an archiver application, or a third-party program. As a result, your confidential documents will be safe with an extra layer of protection that is not included by default on your PC.

Leave a Reply

Your email address will not be published. Required fields are marked *