• Enfield, Waltham Abbey
  • 0844 567 4250


Search Results For Passionate About IT Knowledge Base

How To Create a Password Protected Folder in Windows 7

Dec 7

Written by:
Wed, 07 Dec 2011 12:33:10 GMT  RssIcon

1. First choose or create a folder and give it a name.

2. Open the folder by double left clicking it and then right click anywhere within the open folder and select “New” then “Text Document

3. Rename your newly created text file to 'Password.bat' (make sure the file extension is .bat - not .bat.txt)

Note: that you need to have file extensions view enabled in Windows in order to rename the .txt extension to .bat. Please follow the first to steps of the tutorial HERE if you do not know how to enable it.

4. Right click on the file password.bat and select 'Edit' this will open the file in Notepad.

5. Highlight and Copy the below text and then paste it into the Password.bat file:

title Folder Private
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" 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 "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=>"
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private
echo Folder Unlocked successfully
goto End
echo Invalid password
goto end
md Private
echo Private created successfully
goto End

6. Replace the text in the above script 'ENTER YOUR PASSWORD HERE' with your choice of password - it's best if it is something memorable and unique. Save the file by left clicking 'File' and selecting 'Save' in Notepad and close the file.

7. Now double left click on the password.bat file in the folder and this will create a Private folder. Simply 'copy and paste' the documents/data you want to protect into this Private folder.

8. Once you are finished copying/pasting your documents/data into the Private folder double left click the password.bat file and you will get prompted with: “Are You Sure You Want To Lock The Folder Y/N” - type Y and hit the enter/return key. The Private folder will disappear. It is wise to move the password.bat file to a different location on your computer or on a USB memory stick - as most people who are literate with Windows and bat(ch) files will be able to figure out how to open the password.bat file by right clicking it and selecting 'Edit', which will then reveal your password.

9. If you want the Private folder to reappear - simply move the password.bat file back into the original folder you created, and double left click on the password.bat file, when prompted - enter your password and hit enter/return key - like magic the Private folder will appear once again. Use this technique to Lock/Unlock the file as required.

If you have any questions or problems please do not hesitate to Contact Us.

Please Read:

If this Free tutorial was able to help - show us some support and help keep this knowledge base free by liking us on facebook, +1 us on Google Plus, install our amazing toolbar for instant access to our RSS feeds, follow us on twitter for all the latest trends in I.T and finally join our fantastic community forum where you can find help on all things I.T - from building your own PC to fix-it-yourself solutions from the Pros!

**Revenue from Pay-Per-Click Advertising is used to support this forum, any excess is donated to Doctors Without Borders**

Copyright Passionate About I.T © 2012

53 comments so far...


Step 6 is not clear and hence I am able to do it.
Please provide me with detail instructions, thanks.

By Kantilal (dadasr) on   Thu, 14 Jun 2012 19:18:39 GMT

Hi,In step 6 you need to delete the text "enter your password here" with your own password - the text you need to replace is in the body of the long script above - ill make it bold so you can find it easily by looking.Regards,Aizen

By Aizen on   Thu, 14 Jun 2012 19:31:26 GMT

Hi, i wanted to delete my map, but now i cant!! HELP?!?!?!?!

By Sander on   Tue, 28 Aug 2012 17:02:40 GMT

Hi Sander,

Can you please be clear about what you are trying to delete? It might be worth joining our computer help forum and describing your problem there.

By Aizen on   Tue, 28 Aug 2012 18:04:48 GMT

This worked a treat. Thanks - now I can hide all sorts ;-)

By Jason on   Tue, 28 Aug 2012 18:05:46 GMT

i am not able to implement step 7..please help

By aayushi on   Thu, 31 Jan 2013 11:03:04 GMT

Why not? What is the issue you are having?

By Aizen on   Thu, 31 Jan 2013 11:03:54 GMT

This only makes the folder hidden, i can still open the folder. Is this right?

By Alex on   Wed, 12 Jun 2013 19:36:33 GMT

No - if done correctly it should ask for a password. start from step 1 and work your way through slowly. if you get stuck give us a shout and we'll gladly help out.

By Aizen on   Thu, 13 Jun 2013 09:49:05 GMT

Having trouble getting a private file on step 7 I can only open the note pad

By Lynne on   Mon, 01 Jul 2013 00:01:07 GMT

when i enter password to open the folder it does not show the folder which i had locked

By amir saleem on   Fri, 29 Nov 2013 08:06:14 GMT

clear instructions thank you very much for the help!

By chris on   Thu, 19 Dec 2013 07:04:47 GMT

it works! thanks a lot

By Ngoc on   Sun, 05 Jan 2014 06:17:30 GMT

i am not able to do 7 th step pls help me.

By sachin on   Fri, 11 Apr 2014 10:53:07 GMT

What issue are you having Sachin?

By Aizen on   Fri, 11 Apr 2014 11:44:52 GMT

Could has another way to open the Private folder without use file password.bat? Because if I miss this file and forget the password it will be a big trouble :D

By Le Tu on   Mon, 14 Apr 2014 14:04:35 GMT

but after using this method. anyone can crack my password by right clicking of the mouse on the protected folder and selecting edit. And in the notepad anyone can change my password and it does not ask for any password.
so tell me what should i do to protect my folder.

By somesh singh on   Sun, 04 May 2014 16:14:56 GMT

Hayz! the password.bat is still visible so somebody easily seen my created password and still can access my folder.. is theres other way that no need to do this. ex. if i open the folder it automatically prompt to enter password?

By Dahana on   Thu, 08 May 2014 07:57:31 GMT

Having trouble in getting a private folder on step7. I can only open notepad, how to solve?

By Wenhui on   Wed, 21 May 2014 08:05:14 GMT

it only make it invisible, I want to enter password to view files not become visible

By Trevor on   Thu, 22 May 2014 10:39:06 GMT

I can still access my folder after repeating these steps multiple times from scratch. what can I do?

By ShinYW on   Sun, 25 May 2014 19:38:42 GMT

hi can the password input in the command prompt be asterisk? because the password inserted can be seen. if i wanted it to be asterisk, how can i make it?

By khairul on   Wed, 11 Jun 2014 03:31:36 GMT

I'ts working but anyone can find the password using edit the password.bat file.

By Sunil on   Thu, 12 Jun 2014 11:42:45 GMT


It's very simple - move or hide the password.bat file once the folder is protected. Put it on a memory stick or hide it somewhere else on the computer.

By Aizen on   Thu, 12 Jun 2014 12:12:10 GMT

After protecting the folder according to above steps. How to remove the password and restore the folder in its original form??

By hamza on   Tue, 08 Jul 2014 00:37:33 GMT

This is awesome, it works! English is not my native language but I did it for the first try! :D Thank you for this guide, very easy to understand!

By Anee Lyn on   Sun, 20 Jul 2014 20:15:28 GMT

good job sir. now i can make privacy .thanxx dude

By rahul sharma on   Wed, 06 Aug 2014 03:29:58 GMT

thanx. this works and its easy, all thanx to your simplified instructions but i've noticed something, if you search for something in the private folder on the start search icon, the file appears and you go into it without a password. is there something else i should do?

By hilkkah on   Fri, 22 Aug 2014 01:33:45 GMT

If any one deleted that password.bat file.Then how to recover that folder.

By Rahul on   Tue, 09 Sep 2014 10:24:42 GMT

Create a new password.bat file with the same password, then you can recover it

By Aizen on   Thu, 18 Sep 2014 09:46:22 GMT

this is freakin awesome i love it, ive wanted to be able to do somethin like this for ages but couldnt because the other tutorial i found just didnt work but this worked first try, THANKS A MILLION!

By Steve on   Sat, 04 Oct 2014 11:26:37 GMT

I was able to successfully navigate all of the steps as outlined. However, I initially had a problem with the .bat file. By default, my system has preview pane turned on. So when I have the .bat file highlighted, the contents of the file, including the pasted text with the password is shown. I thought I could hide the .bat file by enabling the 'Show Hidden Files and Folders", but then I would not be able to see the root folder in order to unlock the hidden folder. Then I thought I could move the .bat file to the hidden folder. But then I would not be able to access the unlock .bat file at all. So in the end, I created a shortcut to the .bat file, placed the .bat file in the hidden folder and locked it. Since shortcuts do not show the contents of the file they are pointing to, this appears to have resolved. However, I do have an off topic question. How do I lock the resize/preview pane, any resize/preview pane for that matter, so in this case the preview pane would not have been seen? Thanks in advance for your help.

By MidnightAtom on   Mon, 06 Oct 2014 00:17:21 GMT

Just beware if you have show hidden files selected in folder options you will still get to see all the info you are trying to protect.

By Coder on   Mon, 06 Oct 2014 11:10:50 GMT

I can not get my files to re-appear please help :( I have the password.bat back in original folder and it starts to bring up the black box screen but disappears to quick.

By JOEY on   Tue, 14 Oct 2014 02:56:17 GMT

Hi, it was working flawlessly for me but I moved the folder it was in to another folder by mistake, and it stopped working forever :S, I'm afraid I've lost all I had. Is there anyway to recover it? I tried to move it back to the original place and so, but I won't ever get the "Private" folder back. I do have the password.bat tho.


By PervCoke on   Sat, 18 Oct 2014 04:39:50 GMT

I copied the original folder in the Private folder (Step 7 & 8). How can I view the original one now, as it has disappeared. :(

By Aks on   Sat, 18 Oct 2014 09:56:23 GMT

I can't seem to find my private folder now? how can i see it ? where are my files?

By richard on   Thu, 23 Oct 2014 01:19:47 GMT

Hello, everything worked great! However in step 2.) I had to open notepad from start button and "save as type" ALL FILES. This was the only fault I had which made it work.

By Martin on   Mon, 17 Nov 2014 22:41:57 GMT

Great Work Chum.... it works and good to see this feature works on win7... thumbs up!!

By Zeeshan Ali on   Tue, 18 Nov 2014 22:01:25 GMT

It's works, Thanks

By rajiv kumar on   Fri, 21 Nov 2014 06:29:36 GMT

Thanks it is really helpful for me

By Admasu on   Sun, 30 Nov 2014 07:07:49 GMT

Thanks for the file to protect the folder. It is very easy to create & use. One requirement that i need is:
fyi: I want to use this private folder as storing of live-data as and when my users enter through an application interface.
problem: Since it is hidden, I am unable to access any files through the application and says unable to find the folder. So, I want the folder to READ attribute and at the same time it should be HIDDEN attribute. Is this possible?

By Prakash K Varma on   Wed, 10 Dec 2014 06:34:52 GMT

Thank a lot , this trick very good and can used powerfull. Thank again

By New Name on   Mon, 15 Dec 2014 08:45:41 GMT

it will create a hidden folder in your computer once you set the radio button on for "show hidden folders and files" this folder will appear and there is no need of password.

By Imu on   Tue, 16 Dec 2014 19:57:51 GMT

It's Really Great to hide Particular Folder or Doc...It's Works out well...Thanks for Sharing...

By Suganya on   Tue, 06 Jan 2015 04:44:32 GMT

i just tested and you can rename the "password.bat" folder anything you like as long as the ".bat" remains, this has made it a lot easier to keep safe lol...hope this helps.

By rickykallday on   Wed, 21 Jan 2015 00:34:52 GMT

Thanks for these steps! :D It works and is very helpful!

For people who are facing issues with Step 7 -- one issue may be that when you click on edit, it gives a pop up saying "Incorrect parameter". In that case you can change the extension from '.bat' back to '.txt' and then copy and paste the text code and click on save.
Once done, close the notepad file and then change the extension to '.bat'.

It worked for me this way! :)

By Surbhi on   Wed, 28 Jan 2015 08:58:55 GMT

Very easy to do and works a treat, thanks very much for sharing....

By Darren on   Fri, 06 Feb 2015 16:42:27 GMT

nice :)

By neel on   Tue, 17 Feb 2015 08:55:26 GMT

thnx bro it ws really helpfull

By navi on   Sat, 21 Feb 2015 14:02:16 GMT

It's Really Great, Very Simple and Use full. It's Work fine. Thanks

By Asif ALi Khan on   Wed, 25 Feb 2015 12:23:27 GMT

Hello, I am unable to get this to work. I create .bat file, but when i double click, i see only a flash of a DOS window but cannot interact.

I tried right-clicking on the .bat file and then choosing Run as Administrator which gave me a DOS window which asked if i wanted to lock the folder, but it does not create the Private folder. Nothing i do will create a Private folder nor can i get the DOS windows to show in their entirety (as if the script ran to completion).

It's as if something is stopping the script. I code for a living so i have some familiarity with this, but i'm no expert at shell language (if this is that:))

Help and thanks:)

By steph on   Fri, 27 Mar 2015 04:53:30 GMT

Thanks a lot for ur tutorial

By Swathi on   Fri, 01 May 2015 13:47:48 GMT

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Security Code
Enter the code shown above in the box below
Add Comment   Cancel 

Contact Us

Have an I.T Problem? Get in touch for an informal chat and find out how we can help

Click here

Blog Calendar

<March 2020>
By continuing to use this site you agree to the use of cookies. To view our policy on cookies click here