How to Lock and Hide Folders in Windows Without Additional Software?


If you are new here, Subscribe to Full Feeds or by Email and receive free daily updates on Tips, Tricks and Tweaks..


I wrote about ‘How to lock your PC automatically while you step out?‘ in my last post. Here is another article regarding privacy. Many try to find and install software to lock and hide private folders in the PC. But here is an easy method of locking and hiding folders in Windows without any additional software.

So, How to Lock and Hide Folders in Windows Without Additional Software?

Follow these steps:

1) Open Notepad and copy the contents of the code below. ( Or Click here to get the code in .doc format)

Update: The code given in earlier link is incorrect, please use this new link in .doc format

Hide and Lock Folders without any Software

2) Change the password by replacing ‘type your password here‘ in the code with your password.


3) Save it as XYZ.bat (Note: Try to be innovative and save it in such a way that it sounds like a system file so that nobody will try to bother clicking it)

Update: If you are not sure how to change the file extension from .txt to .bat, check How to Change File Extension in Windows.

4) Close the file if it is still opened and double click XYZ.bat
5) It will create a new folder called ‘Locker’ automatically. (If you want the file name to be different, find and replace Locker in the code with the name of your choice). This new locker folder will be created in the same hierarchy as the .bat file.


6) Place the contents inside and double click XYZ.bat, it will ask whether you want to lock. Say ‘Y’ and now your folder will disappear.


7) To view again, double click XYZ.bat again and enter your password.

Frequently asked questions:

1. What if I no longer want to hide the folder?

Just delete the XYZ.bat file when the locker folder is in visible mode. Or you can rename the Locker folder to something else and the next time if you double click, it will create an empty Locker folder.

2. What if I deleted the .bat file when the Locker folder is not hidden?

You can download the code again, change the password and create the XYZ.bat file. Now paste that file in the same hierarchy as the Locker folder. It will work as before with the new password.

3. What if I deleted the .bat file when the Locker folder is hidden?

The contents are still there hidden, so don’t panic! Just download the code again, change the password and create the XYZ.bat file. Now paste that file in the same hierarchy as the Locker folder is hidden. Double click the .bat file and you can unlock the Locker folder with the new password.

Note: This trick is only to provide Privacy, so that nobody accidentally opens your private folders. It does not provide any ultimate security. Anybody can open XYZ.bat in any text editor and view the code. As I had mentioned it before try to keep this file in not an obvious place with a name that looks like a system file, so that nobody will have a chance to touch or doubt at this file.


Related Posts:
  • The Best of Last Month from Lyte Byte - 3
  • How to Show and Hide File Extensions in Windows?
  • It’s been a Year!
  • How to view Hidden Files and Folders in Windows?
  • How to lock your PC automatically while you step out?


  • Enjoyed this post? Subscribe to Full Feeds or by Email and receive free daily updates on Tips, Tricks and Tweaks.


    66 Responses to “How to Lock and Hide Folders in Windows Without Additional Software?”


    1. 1 Beta3

      Great one. This is really something different. Need to try this one out. :)

    2. 2 Hans

      Nice one :)

    3. 3 shoot

      doesn’t work for me :( good idea tho

    4. 4 Mr.Byte

      @shoot, Thanks for pointing it out…some character were missing in the earlier attached format…Please use the new attachment.

    5. 5 ram

      Good idea :-)

    6. 6 Nirmal

      Nice tip. Stumbled.

    7. 7 Madhur Kapoor

      Good tip man .

    8. 8 vollmond

      Windows has a built-in utility to build executables from .bat files; if that was done with this, it would reduce anyone’s ability to inspect the code.

    9. 9 Andrew Johnson

      The new attachment also did not work for me. No new file was created..:(

    10. 10 Mr.Byte

      @Andrew Johnson, Which OS are you using? I verified this new file in a different system and it works for me…I hope you are saving the file as XYZ.bat and not like XYZ.bat.txt…If you can explain more like what are you getting I can help then…

    11. 11 Subbu

      Fyi……….

      Abt the lock and darwback !

      1> If u delete the bat file you will miss the folder
      2> After folder get locked , bat file - right click and open with notepad
      you can view the password.

      Any way not bad - !

    12. 12 Subbu

      Friends

      I am not a software pg , could u plz update me
      Which language is this …..

    13. 13 Mr.Byte

      @Subbu, I am aware of what you have mentioned and that’s what I have mentioned in the last para of my post…abt the language of the program you have mentioned, its just the system commands that are put together to perform this function. If you want you can execute each command individually in manual mode to perform the same function…

    14. 14 Subbu

      Hello Mr Byte,
      Thank for the detail!
      One more thing .
      Is it possible to rectify these drawbacks?

      1> If u delete the bat file you will miss the folder
      2> After folder get locked, bat file - right click and open with notepad you can view the password.

    15. 15 donjohnson

      This will only make the folder invisible and provide it with a bogus name. It’s still accessible when typing the full path directly, or when ’show hidden files’ and ’show system files’ are enabled (what a lot of people do these days).

      Locking a folder is something completely different…

    16. 16 Mr.Byte

      @donjohnson, When it is locked it will not be accessible when you type the full path and also when you lock and hide it will not be visible even when ’show hidden files’ is enabled…. Try it out and you will know what I mean…

    17. 17 Ersin

      hi,

      i have a bug i guess

      after existing Locker folder, i run .bat file and hide folder. then Locker folder disappears.

      after these steps, if i create a new folder that has name “Locker” same as old folder, and i run .bat file; old folder Locker does not return. Instead of this the control panel’s shortcut is created.

      But if i delete folder that i created as “locker”, than i run .bat again, enter password; real old Locker folder returns.

      i hope i described well.
      thanks

    18. 18 dEEPAK

      one workaround for people opening the .bat file to see the password can be that rename it to something else(other than .bat)and whenever u need to access the folder rename it to .bat .. I know this is not feasible if you use it very often. but still if you need security…

    19. 19 PSR

      Excellent. If you could explain the technology behind this (I mean what each one of those native command does), I will try to make a program out of it.

    20. 20 Glock

      I love this, i always used a software to do this, thnx alot i dont any need any now! thnx :D

    21. 21 hardhed

      It accepts any password you enter.

      Can I suggest replacing the line after “echo Enter password to Unlock folder”
      with
      set /p input=”Please enter the password: ”
      set /a count=count 1
      if (%input%)==() goto FAIL
      if not (%input%)==(hardhed) goto FAIL

      Change “hardhed” to a word of your own choice.

    22. 22 hardhed

      Although the portion of script I found and resolves the password issue, you can still right click and edit to find password. I’ve attempted to convert it from a batch file into an exe file but havent been successful yet. By doing so it would rectify the right click edit issue. Any ideas would be helpful

    23. 23 cristy

      tnx..i learned something today..great!

    24. 24 Rich

      great work - thx - a cute piece of work just what is needed for a simple approach - never going to beat a hacker but keeps things simple

    25. 25 deyamag

      Is there any way by using regedit only?
      thanks.

    26. 26 max

      NOT work in my pc
      it not create any folder .nice trick

    27. 27 hardhed

      cls

      @ECHO OFF

      title Folder Locker

      if EXIST “Control Panel.{21EC2020- 3AEA-1069- A2DD-08002B30309 D}” goto UNLOCK

      if NOT EXIST Locker goto MDLOCKER

      :CONFIRM

      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

      :LOCK

      ren Locker “Control Panel.{21EC2020- 3AEA-1069- A2DD-08002B30309 D}”

      attrib h s “Control Panel.{21EC2020- 3AEA-1069- A2DD-08002B30309 D}”

      echo Folder locked

      goto End

      :UNLOCK

      echo Enter password to Unlock folder

      set /p input=”Please enter the password: ”
      set /a count=count 1
      if (%input%)==() goto FAIL
      if not (%input%)==(whodear) goto FAIL

      attrib -h -s “Control Panel.{21EC2020- 3AEA-1069- A2DD-08002B30309 D}”

      ren “Control Panel.{21EC2020- 3AEA-1069- A2DD-08002B30309 D}” Locker

      echo Folder Unlocked successfully

      goto End

      :FAIL

      echo Invalid password

      goto end

      :MDLOCKER

      md Locker

      echo Locker created successfully

      goto End

      :End

      above is the entire code to use. Read through the code and replace the word “whodear” with one of your choice. The word you choose will be your password.

      Just open notepad and paste the code inside. save it as locker.bat. A bat file will appear on your desktop. Double click on the .bat file and the cmd prompt window will appear. type your password in and press enter. Your folder will then appear underneath the .bat file on your desktop. To hide the folder again just double click on the .bat file again and the cmd prompt window will ask you if you want to hide the folder. Press “Y” or “N”. Y=yes and N=no.

    28. 28 hardhed

      Have you ever wondered, how can you make a folder invisible without even using any kind of softwares?
      Well, here is the answer to that. It is very much possible and Windows will help us in doing this.
      How? Lets see the answer
      Code:

      [list]
      1. Create any new Folder or file.

      2. Right click and go to Rename, remove the content, press “Alt” and type “0160?. The Folder name would become NIL.

      You must use the number pad on your keypad in order for it to work. If you own a laptop without a keypad, I suggest you create it on a desktop and then transfer it over to your laptop.

      3. Now go on to the properties of the folder and click “Customize”, and click “Change Icon”.
      4. Here you will find some icons without any kind of images.

      5. Select any of these images and click “OK”. You will now see that your folder is now invisible.
      [/list]

      This works with XP. I haven’t tested it with Vista yet. Also, this method works also with any type of file, not just folders. Such as the .bat file that you created in the tutorial above. also, Pressing Ctrl A should highlight where the folder was placed on your desktop.

    29. 29 jake

      on vista (dont know about xp)
      all it does is make the folder a hidden folder

    30. 30 jim

      is there a way to encrypt folder when you hide it. i like this
      lock folder approach

    31. 31 ranjha

      it makes a new file but double clicking it does not open command prompt window…..
      so it does not work…

      any solutions for that

    32. 32 Jd

      This is excellent! But I have one small question, how do you change the password?

    33. 33 Steve

      HELP!!! I used this and it was working, then one day the folder disappeared and when i tried to recover it all i got was a link to the control panel and i DON’T KNOW WHAT TO DO! Please help me out.

    34. 34 Shaikh

      Every one knows how to crack it. Now what is other option for locking folder, is using other system. and used with regedit class keys.

    35. 35 Eh

      sorry to all this is very simple way to hidden files it work just for beginners! this bat file run attrib command and hidden folder( h) and change it to a system file ( s) and rename (ren) it to (Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}) simply if you go to: tools-folder options -view there are “Hidden files and folders” put radio buttom to
      “show hidden files” to show hidden files and then click on “hide protected operating system files” to remove check mark
      press ok now you can see (Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}) now just rename it locker or d or f or anything els!!! and see or delete all files on it run “cmd” type attrib -h -s [file or folder name]
      to undo hidden and system attribution .
      but it was fun :)

    36. 36 Harinder

      there is a problem with this code

      In line no 9 it should be set/p “echo=>” instead of set/p “cho=>”

    37. 37 TyL3r J****

      Hey there is a really simple way of protecting the password… get the program Bat_To_Exe_Converter, it is not a really fancy program, but it does make the bat a little more protected, but when you do that you can no longer change you password. so that is one downside

    38. 38 TyL3r J****

      hey, i have a question, i am making a complete program that will install and uninstall everything, but when i convert to .exe i can’t change the password. i want to be able for my fiends to change the password while in the command prompt, is that possible? and i also made a batch file(which later i will convert to a .exe) that will install the proper files that i had made along with the original that hid the folder. i will be putting this program on a cd, and if it detects that it is already installed it will delete it. i have also made a few .vbscript files that creates a message when something is complete. example: when it is done creating a folder it will pop up a message that will say, folder created successfully. but the only thing i cant seem to do is the password thing, please help!!!!

    39. 39 shubhamay

      friends i have made a batch file to gurd a folder but unfortunately my key for that folder was deleted so kindly give me advise how i can recover my data saved in that folder.

    40. 40 Sayem

      This is not good tricks for me.when anybody rename the folder,the folder make a normal folder.

    41. 41 Ajeet

      I have modified the code a little bit to hide password and have dialogue box to unhide it… works fine…

    42. 42 Ajeet

      I mean hide password while typing(not in batch file)…

    43. 43 ajaaibu

      If the guy have got a brain. He’ll come to know about the secret. Its just adding the following extension to folder .{21EC2020-3AEA-1069-A2DD-08002B30309D} , folder can be opened when ever that extension is removed by renaming the folder… :P

    44. 44 Andrew

      well..the folder “locker” has appeared. when i double click on the .bat file again, i get the message “are u sure u want to lock the folder (y/n)” nothing seems to happen after i enter “y” or “Y”.. wts the problem??

    45. 45 Mr.Byte

      @ajaaibu, thats exactly what I had mentioned in the bottom note in non technical terms. This is just to make sure that nobody accidentally opens in your private folder. Anybody can crack it down if that person is sitting down in front of your computer with the intention of finding the hidden folder.

    46. 46 vladimir

      woooow!!!
      this is a good thing!!!!
      is there any other ways like this to hide a folder and open it only with pass??

    47. 47 vinal

      cheers this is gud, im usin it my self!!
      but i heard there r simple ways of hackin into this! is this true?

    48. 48 Carter

      Is there any way to make this lock a folder of your choice?

    49. 49 Carter

      Also, “vinal”, there is a very simple way to hack this.
      If you know ANYTHING (really) about batch files, you can edit the batch, and change the password, just like you did at the beginning.

    50. 50 Nobil Vargghese

      Hi,

      Can somebody help me with the problem….

      I have hidden my folder with batch file programming. My company had installed a domain (Administrator)on my PC. Now the folder which I have locked is not accessible to me. I can not copy this to any other drives. When I click on any file it shows “ATTRIBUTES : Encrypted”. Can somebody suggest me how to unencrypted my folder so that I can copy the folders to another drive. I have used simple methods from Microsoft help.

      Please people HELP ME!!!!!!!
      URGENT
      Nobil Vargghese

    51. 51 Tania

      Hi!
      I did everything and it all worked out!
      But when I double click xyz again to view the contents of the locker folder (and I expect it to ask for the password) it says if I want to lock the folder (Y/N) which is the same thing it said in the beginning. It keeps on doing that, and never asks for a password, so in other words, I cannot view the stuff I put inside the locker folder because when I open it, it says it’s empty. !!! What can I do???

    52. 52 me

      this is cool, but don’t work too well on vista.
      here are some issues and some help:
      1- if in vista you cant use this in program files because you need rights to create folders, try right click run as admin.
      2- if in vista the file is still accessible normally( i have show hidden files enabled and show system files, so I could still see the folder, its simply renamed. opened it up like normal)

      still its nice and simple :D

    53. 53 mota

      grt software dude….

    54. 54 dhaval

      it realy works i have tries and its nice trick to have some sort of security

    55. 55 Smurf

      wath about to convert this code to some *.exe file, so u cant open it in notepad… ???

    56. 56 Harry

      I used the .bat file to unlock a folder on my external hard drive. But after locking the folder i completely formatted my operating system (vista) and re-installed it. Now when i am trying to unlock the locked folder on my external hard drive, i am unable to unlock it.
      I know there will be a work around for this.

      I will greatly appreciate if any one can provide me a solution for this.
      I lost more than 60GB of data because of this.

      Thanks.

    57. 57 GGiant

      How to reverse this.

    58. 58 Mr.Byte

      @To all,
      I have updated the article with some pics for better understanding and have added some more notes on FAQ.
      What if I no longer want to hide the folder?
      What if I deleted the .bat file when the Locker folder is not hidden?
      What if I deleted the .bat file when the Locker folder is hidden?
      If there are any other question, drop your comments.
      Thanks!

    59. 59 dt

      good alternative is http://www.truecrypt.org

    60. 60 Dimo

      hey guys, man you saying to put the code , or the bat file away , that no one could reach/see it… why wont you hide it too, make it hidden, and if you want to open your folder , you just right it up there “d:/locker” and then it will ask the password and ….. so you would have the bat file and the folder at the same place.
      *its not an ultimate security, just not let any one pay attention to the private folder.

    61. 61 Mel

      How can we make the Locker file open up on a network drive instead of on the desktop?

    62. 62 beastmaster

      The “locker” folder seems be locked by redirecting you to the control panel folder.
      The simplest way to break the lock is rename the folder to anything u wish and all its contents are available.

      My recommendation: Never use this to lock your folders.

    1. 1 How to Show and Hide File Extensions in Windows?
    2. 2 Links this Sunday — Shankar Ganesh | Tech Blog
    3. 3 The Best of Last Month from Lyte Byte - 3
    4. 4 It’s been a Year!

    Leave a Reply




    LyteByte Full Feed

    About Lyte Byte & Me

    Bringing you Tips, Tutorials, and Tweaks on Computers, Internet, Operating System, Windows Vista, Office Applications, Web 2.0, Gadgets, Science, and Technology.
    Its a byte of technology, did you have your byte today?


    subscribe through Email




    Close
    E-mail It