Home / Microsoft Windows / How to password protect a folder in Windows 10 without Software

How to password protect a folder in Windows 10 without Software

One of the most asked questions by our readers on windows is, “How to password protect a folder without using any software?‘.

Indeed, you want to protect and hide your files or folder from other people such that they cannot access or view the files without your permission.

If you want to protect your files and folders, making them hidden from others, you can hide them by specifying the attribute as system files. These files and folders will not show even if “show hidden files and folder” are enabled, which we already saw in our previous post on How to Hide Files on Windows 10 as System File.

However, if you are looking for software that can password protect your folder in windows, then there are many good software available in the market.

However, if you don’t want to shell out money to buy such software, then you may try using the below trick. This trick is similar to our previous post where we hide the files, making them as system files. 

The code is a series of windows commands that will be executed whenever you run the file. The file is saved with the .bat extension, which is also called a batch file. 

The code below was posted on many forums, but credit goes to the original creator, which we are unaware of.

When you run the program, it will create a new folder. Files you want to keep hidden and safe, you can copy those files into this folder and rerun the program. Once you run the program, the newly created folder will vanish and not be visible even if “show hidden files and folder” is enabled.

Follow the below steps on how to password protect a folder without software in Windows 10

1. Open Notepad, Start –> Run –> Type Notepad and Press Enter.

2. Copy the below Code and Paste the following code in notepad and save the file Named Mylocker.bat or name it whatever you want but make sure it ends with an extension as “.bat”.

title Folder Locker
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
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.
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 By Techie Inspire
echo Enter password to Unlock folder...
set/p "pass=>"
if NOT %pass%==typepasswordhere 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
goto end
md Locker
echo Locker created successfully
goto End

3. Now, Execute (double click) the Mylocker.bat, and a new folder will be created named as “Locker”. Store your secret files and folder inside this folder.

4. Double-click again on the Mylocker.bat file to Lock the folder. It will ask for confirmation, type Y, and press Enter. You will see the “Locker” folder has disappeared.

how to password protect a folder

5. To Unlock, Double-click the Locker.bat and Enter Password. The Folder Locker is back again.

password protect a folder

How to Set Password?

In the Code, The Password is set to “typepasswordhere”, Find the Password “typepasswordhere” and change it with your Password.

password protect folder

This program seems fantastic, but there are some drawbacks too.

  • Suppose you have changed the windows folder options settings “Hide Protected Operating System Files” to disable(unchecked). You could see the Locker folder has turned into some control panel icon. If you rename that control panel, the folder will be back. 
  • One more drawback of this program is that anyone can change or see the Password in the code of “locker.bat”. 

This trick is perhaps good for hiding things from family or friends, but if the files are important and confidential, you should use some alternative method with suitable software to lock personal data. 

About Roshan Karkera

Roshan Karkera a.k.a. k.roshan. Blogger by passion and software engineer by profession. He believes in sharing knowledge, which made him to start his own blog. He is very much keen & passionate about new technology & Science. If you'd like to connect with him, follow at Google plus or Twitter.


  1. hi
    dj roshan
    i loved ur site and its cool and great
    After coming to your site. i have learnt many things thanks.
    and also all ur post is very usefull
    thank you for that

  2. How do you do the coding?..Is it using C#?

  3. Coding which is used here is basically windows command i.e.,Command prompt command.This code works with the help of windows command prompt…

  4. This is excellent man.I m using this now,Great way of protecting files.thanks

  5. above folder encrypton code is awesom.But any one can see our password by clicking on edit.

  6. I have a problem I locked my important files with this method, but accidentally it was deleted , how can I recover it, it’s not showing in recycle bin…please let me know …

Leave a Reply

Your email address will not be published.