How to Password Protect a Folder on Windows
Why the .bat trick that circulates online protects nothing, and the two real options (EFS and 7-Zip).
First, an important warning: you'll find a widely repeated "trick" online that uses a .bat file to password protect a folder. Don't use it — it isn't real security.
Why avoid the .bat file trick: that method stores the password as unencrypted text, inside the .bat file itself. Anyone who opens that file with Notepad sees the password directly, or can change it to their own without knowing the original. It protects nothing against someone with even a little technical curiosity.
Option 1: EFS encryption (built-in, free, no programs)
- Right-click the folder → Properties → "Advanced".
- Check "Encrypt contents to secure data" → OK → Apply.
This isn't exactly an independent "password" — it ties access to your own Windows user account. As long as you're signed in with your account, you access it normally; another account on the same machine won't be able to open the content. It's real protection, though different from typing a key every time.
Option 2: compress with a real password (7-Zip, free)
If you'd rather have a password independent of your user account (useful if you're going to send the folder to someone else, for example):
- Install 7-Zip (free, open source).
- Right-click the folder → "7-Zip" → "Add to archive".
- Under "Encryption", type your password and choose "AES-256" (the most secure standard available).
Warning: with this method, if you forget the password, there is no way to recover the content — neither 7-Zip nor anyone else can bypass properly done AES-256 encryption. Save the password somewhere safe and accessible.
Which one should you choose?
If you just want other accounts on the same PC to not have access, EFS is more convenient (no password to remember every time). If you need to send the folder to someone else or protect something with a key independent of your account, compressing with 7-Zip is the right option.
Frequently asked questions
Why shouldn't I use the .bat file trick seen in so many tutorials?
Because the password is stored as unencrypted text inside the .bat file itself — anyone who opens it with Notepad can read it or change it, with no real protection behind it.
Does EFS encryption ask for a password every time I open the folder?
No, it's tied to your Windows user account — as long as you're signed in with your account, you access it with no extra step. Other accounts on the same machine won't be able to open it.
What happens if I forget the password of a folder compressed with 7-Zip?
There is no way to recover it — AES-256 encryption has no backdoor. It's important to save the password somewhere safe before you lose access to the original unprotected content.