How to Create Password-Protected Folder in Windows XP without any Software?

In my previous blog entry on how to hide your folder without any software, several readers commented that the so-called “invisible folder” can be easily make visible if you unchecked the “hide protected operating system files” in the folder options and once visible, anyone can access the folder with ease.

Now, I want to show you a better windows XP’s trick which I learned it from Digital Quest. Still, you will learn how to create an invisible folder but now with security protection. You will need to provide password to reveal and open your folder. You will do this without using any software.

If you are interested, just follow the instructions below.

  1. Copy and paste the following code into Notepad.
  2. cls
    title Folder Personal
    if EXIST “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” goto UNLOCK
    if NOT EXIST Personal goto MDLOCKER
    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.
    goto CONFIRM
    ren Personal “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%==pwd123 HERE goto FAIL
    attrib -h -s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
    ren “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” Personal
    echo Folder Unlocked successfully
    goto End
    echo Invalid password
    goto end
    md Personal
    echo Personal created successfully
    goto End

  3. Save the file as secret.bat ( or whatever name that you prefer but make sure the file end with .bat extension )
  4. Move secret.bat batch file to the directory that you want to create your protected folder.
  5. Run the batch file by double-clicking it. A folder with the name “Personal” will be created.
  6. Now, you can insert any file into the folder.
  7. To lock the folder, you need to run the batch file again. A command prompt will pop up and asked whether you want to lock the folder. Key in ‘Y’ (for Yes) and hit Enter. Your folder becomes invisible.
  8. Create Password Protected Folder Without Any Software

  9. To unlock the folder, run the batch file. You will be prompted to enter the password. Enter the password (default = pwd123 ), hit enter. The folder appears.
  10. Create Password Protected Folder Without Any Software

You can change the name of the password-protected folder. You need to edit the batch file before you run the batch file for the first time, replace the word “Personal” with your desired name. There is a total of 6 words to replace. If you don’t prefer the default password, change the “pwd123″ with your desired password.

Note : Anyone can open the batch file and view your password. For precaution, you might want to keep the batch file on separate directory or on pen drive. When you want to open the password-protected folder, you can copy the batch file to the location where you keep the protected folder and run it.

Steve Yu is a technology blogger with five years blogging experience (since 2007). He is the founder of


  1. shen

    July 13, 2008 at 1:17 pm

    it doesn’t work with vista?

  2. Steve Yu

    July 13, 2008 at 4:49 pm

    shen > I don’t know because I’m using XP. You can try it yourselves and let us know. :D

  3. Nihar

    July 14, 2008 at 10:51 am


    Good tip. Keep coming with more tips in future…

    Nihars last blog post..Great Civilizations of Ancient World

  4. ipohchai

    July 15, 2008 at 6:13 am

    cool! but I wonder if we can encrypt the password in the source .bat file so that i will not be visible.
    needing to move this file away to protect it is troublesome

  5. Michael Aulia

    July 31, 2008 at 7:21 pm

    So trouble some :’( I guess it’s worth it if you really have important stuffs on your computer hehe

    Michael Aulias last blog post..Mass Effect FREE downloadable content for PC

  6. YHAD

    October 27, 2008 at 11:46 am

    hi! i run the batch file and created the folder..the problem is whenever i try to re run the batch file to lock the folder, the command prompt appears and when i hit the Y, the folder still visible and unlock..please help..there must be wrong with the codes.

  7. Steve Yu

    October 27, 2008 at 9:13 pm

    YHAD > You try re-type this sign ( ” ) in the code. I’m sure it will working now. :-)


    February 20, 2009 at 2:25 am

    hello dear
    i know many tips from u and from your site. thank you

  9. Buneet

    February 21, 2009 at 12:33 am

    It is some thing helpfull but not workinvg properly because of any wrong code u plzz check it and let me inform u can send me the correct code as a email my email address is i realy nead this so plz try to help me out

  10. Steve Yu

    February 21, 2009 at 12:38 am

    Buneet > You need to re-type this sign ( ” ) in the code.

  11. vaughn

    February 22, 2009 at 5:57 am

    Please let me know how to open the file thru RUN

  12. skywalker

    March 4, 2009 at 8:21 am

    this is good but there is a disadvantage. the hide function will not perform when the data inside the folder was link to other file outside the folder…

  13. skywalker

    March 4, 2009 at 8:25 am

    please let me know if someone can modified this code that will help to solve the problem stated above. thanks…

  14. Deltamistry

    March 4, 2009 at 9:42 am

    I did everything– but I can not unlock it now–what should I do

  15. skywalker

    March 5, 2009 at 8:39 am

    do everything like debugging manually line by line to retype the ” character…

  16. yamini

    March 8, 2009 at 8:15 pm

    hi!!! i run the above batch file its working. At first it was’nt work but i retyped the ” character and tried it works.
    thankyou steve yu

  17. morry

    April 29, 2009 at 8:37 pm

    Very cool! it works!

  18. Sarath

    May 14, 2009 at 3:11 am

    Right click the batch file and use edit option to open the file. Now copy –> “ and use ctr+h to replace all with ” and also copy –> ” to replace all with ” and then save it. And run the batch file now it works fine

  19. David

    June 20, 2009 at 6:49 am

    Ok, when I unlock the folder, it opens up control panel. I run on windows xp but got new updates for it today – could that be an issue? I cannot locate my files.

  20. shambhu

    June 28, 2009 at 3:22 pm

    I can’t creat password as your tips

  21. Anil Verma

    August 3, 2009 at 2:05 pm

    Hi There,

    After weekend login when i click on batch file my personal folder visible without showing password window n there in no more data in personal folder.I have lost my data from personal folder how can i recover my data plz suggest me somthing there is all major official details which i have lost……

    Waiting here

  22. Jude

    October 2, 2009 at 10:22 pm

    I tried this but it dint just work
    I dont no if i was getting something wrong, but I followed the steps over and over again but to no avail.
    Please help!

  23. madshark

    October 7, 2009 at 8:56 pm

    it worked for me..replace all the double quotes with your keyboard double quotes.
    at this line:

    if NOT %pass%==pwd123 HERE goto FAIL

    delete “HERE”

    If you want it to loop if the password is not correct, at this line:

    echo Invalid password
    goto end

    replace those with these:

    echo Invalid password
    goto UNLOCK

    hope this will help

  24. daywalker

    October 27, 2009 at 12:54 pm

    nice application…keep going.. kudos for you my frend

  25. Megala

    November 7, 2009 at 12:43 am

    It’s wont work

  26. random dude

    March 9, 2010 at 7:11 pm

    i have edited the file it works it runs but will not unlock i did not change the password i just type it the file closes and it remains a control panel shortcut please help.

  27. lordantz

    July 7, 2010 at 1:17 pm

    very cool steve..

    is there any way to run the batch file only once?
    then everytime i open the folder that’s the time
    the “enter password” will prompt?

    is there other way not to hide the folder? but still it is password protected.

  28. Plato

    July 8, 2010 at 6:32 pm

    Convert the bat file to exe file using this free conversion tool and delete the bat file.
    So there will be only exe . No one can see the password. use the exe every time you want to
    protect and unprotect the folder.


  29. Mohammad Raihan Mazumder

    July 13, 2010 at 8:00 pm

    If you want LOCK from Command Prompt your folder in Windows 98 please go to>>

    Start> RUN> CMD>

    g:\>ren alt+197 folder-name
    g:\>ren alt+454 folder-name

    g:\>ren alt+197 folder-name
    g:\>ren alt+197 g:/folder-name

  30. Anonymous

    July 14, 2010 at 12:20 pm

    Do you have a vesion for Windows 7?

  31. Farhan SEO

    August 12, 2010 at 1:02 pm

    your site is very helpful. thankx but this code is not working plz retype it or upload it to some location at FTp or Http. so we can download it

  32. Anonymous

    November 10, 2010 at 7:19 am

    actualy it’s not make Folder a Password Protected. this code just change your folder.

  33. Denisse

    May 11, 2011 at 4:41 am

    Thanks so much! It really works.. just read/follow the instructions carefully.

    This made me feel a bit genius. hahaha!

  34. Rakesh kumar

    June 25, 2011 at 4:57 pm

    folder lock not working properly in window XP pack1. can u help me………

  35. ulix

    July 10, 2011 at 3:57 am

    its working nd its cool.. nice haha..

  36. Punarvasu

    July 13, 2011 at 2:05 pm

    I like the tip.
    Very useful for me.. thanks.. :)

  37. Kellie Andrew

    July 15, 2011 at 1:41 am

    This is really cool ^^ but there’a lil bug it will still show the folder even if you enter a wrong password… Try removing the word “HERE” in the code. This is really cool stuff ^^ Hope to learn more From you ^^ Thanks ^^

  38. lewy

    July 19, 2011 at 7:52 pm

    this will not work on win 7!!!

  39. Humxa

    July 23, 2011 at 7:33 pm

    The folder disappears but doesn’t comes bak…… please halp….

  40. Smarth Grover

    August 1, 2011 at 6:44 pm

    hi!this thing really wurks! but when I unlocked d folder,then i cannot lock it!! if I open d batch file,it creates a new folder every time

  41. gideon edwards

    August 17, 2011 at 11:18 am

    could you follow through for me how i can protect my folders by using passwords to access.

  42. sam

    August 23, 2011 at 4:26 pm

    i tried but it didn’t work.i am using windows7.
    can anyone say how to do this in windows7.

  43. Prabhat

    September 19, 2011 at 12:16 am

    code seems to work but folder is not getting locked nither its hiding.

  44. Irshad

    September 29, 2011 at 4:09 pm worked for me!!

  45. Jeff

    September 30, 2011 at 3:26 am

    This trick really works! I followed the same trick though found it on other website: How to Password Protect Folder in Windows. Will definitely recommend this. :)

  46. Shikha Raheja

    October 5, 2011 at 11:02 am

    it dint work for me..the command prompt for a moment n then disappeared..what might be the possible cause of this.
    Please suggest

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>