How to Put a Password on a Folder in Windows and MacOS

September 5, 2019 • Shannon Flynn


If you work with computer files you only want yourself or specific people to be able to access, you may wonder how to put a password on a folder.

Doing so means only people with the password can see the contents. That could be helpful for boosting security in both your work and personal life. For example, if you’re working on the details of a surprise birthday party for a friend and have related folders, those would be good to password-protect.

Or, if you have confidential documents for work and worry about someone intentionally or accidentally seeing them, it’s useful to know how to apply a password to the folder that holds them. Your workplace may even require you to do that as part of its cybersecurity strategy.

One of the potential downsides of encrypting files in password-protected folders is that doing so could make it challenging to collaborate with others — especially if you have a large team. It also gives you something to remember to do, since you have to make sure to provide a person with the correct password when you decide they need to use the folder.

Although password protection is not the best option in every case, it’s good to know how to do it when necessary or desired. Let’s get started.

File Encryption in Windows

The Windows operating system does not make it as easy as you might expect to use a password for a folder. The closest native option is to encrypt the contents of a folder to safeguard them. Otherwise, you need to use a third-party program to set up a password-based system.

If you’re interested in the encryption option, here’s what to do:

  • Launch File Explorer.
  • Find the folder you want to protect and right-click on it.
  • Choose Properties.
  • Press the Advanced button in the box that appears.
  • Put a check in the Encrypt Contents to Secure Data option.

After you do that, a window will pop up that contains the encryption key and an accompanying certificate. You’ll also get a prompt asking if you want to back up the encryption key and certificate in case you lose it. Follow the steps described in the window if you choose that option.

Use a Batch Script to Protect Your Windows Files

You may already know how to rename Windows folders in bulk. If you want to do something else in bulk by applying passwords to several folders, the encryption method above isn’t ideal. However, another available option is to use a batch script. First, create a new folder in Windows that you’ll use as a safe. Right-click anywhere on the screen and choose New > Folder.

Then, go inside your new folder by double-clicking it. Next, right-click inside the folder and choose New > Text Document.

Once you have the text document open on your screen, paste this text into it:


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 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}" Locker

echo Folder Unlocked successfully

goto End


echo Invalid password

goto end


md Locker

echo Locker created successfully

goto End


Notice the “if NOT %pass%==your_password goto FAIL” line? Change the “your_password” part so it shows whatever password you want to use.

Finally, go to File > Save As and save the file. Make sure to add the .bat extension to the end. Double-click the BAT file to create a folder of the same name. Then, drag all the files you want to protect inside that folder and double-click your BAT file again. You’ll then see a command prompt that asks you if you’re sure you want to lock your folder. Press Y on your keyboard, then the Enter key.

How to Put a Password on a Folder When Using a Mac

The Mac operating system is similar to Windows in that you can’t apply a password directly to a folder, but can set up a password-protected disk image.

  • Go to Applications > Utilities > Disk Utility.
  • In Disk Utility, click File > New Image > Image From Folder.
  • Find the folder to protect, click it and press the Choose button.
  • A box will pop up that lets you save your new disk image.
  • Save it as any name you want.
  • Select 128-bit AES from the Encryption dropdown and Read/Write for the Image Format.
  • When you select the kind of encryption you want, it’ll ask you to enter and confirm your password.
  • Click Choose to set the password.
  • Notice the dialog box that says “Disk Utility is creating your disk image.”
  • You can then delete the original folder.

Putting passwords on folders like this is an excellent way to immediately enhance your cybersecurity strategies. Also, it only takes a minute or two after you get used to the steps.

Locking Your Folders Could Be a Smart Decision

Learning how to put a password on a folder is an excellent way to ensure only authorized parties see the contents. Think about doing it the next time there’s a chance or a certainty of someone using your computer or being able to access it.