There are plenty of software which locks drives and folder to protect your confidential data. Why waste money on such tools when you can do it with a simple registry tweak? Here’s how:
Caution: Before you attempt these tweaks, please make sure that you have a backup of your registry, just incase something goes wrong in the middle.
Locking Folders:
- Consider you want to lock a folder named XXXX in your E:\, whose path is E:\XXXX.
- Now open the Notepad and type the following
[code]ren xxxx xxxx.{21EC2020-3AEA-1069-A2DD-08002B30309D}[/code]
- Where xxxx is your folder name. Save the text file as loc.bat in the same drive.
- Open another new notepad text file and type the following
[code]ren xxxx.{21EC2020-3AEA-1069-A2DD-08002B30309D} xxxx[/code]
- Save the text file as key.bat in the same drive.
Steps to lock the folder:
- To lock the xxxx folder, simply click the loc.bat and it will transform into control panel icon which is inaccessible.
- To unlock the folder click the key.bat file. Thus the folder will be unlocked and the contents are accessible.
Locking Drives:
We don’t usually prefer to lock our drives, but sometimes it becomes nesscary. Say for instance you might have stored your office documents in D:\ and you don’t want your kids to access it, in such case this technique can be useful for you. Please don’t try this tweak with your root drive (usually C:\ is the root drive) since root drives are not intended to be locked because they are mandatory for the system and application programs.
- Start & Run and type Regedit to open Registry editor
- Browse HKEY_CURRENT_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\Explorer
- Create a new DWORD value NoViewOnDrive and set its value as
2^ (Alpha Number of Drive Letter-1) where Alpha number are simple counting of alphabets from A to Z as 1 - 26
For example: to lock C:\, Alpha number of C is 3 so 2^ (3-1) = 4 (decimal value)
- To lock more drives, calculate the value of each drive and then set sum of those numbers as value
- To unlock your drive just delete the key from the registry.
Hat Tip by anilmail17 and wizrulz.

wrote, on February 5th, 2007
Nice post sankar. Like this we can change it to control panel (the example you gave)….to my computer and other system folders like this….its simply helpful
wrote, on February 5th, 2007
Lock Folders in Windows
Windows has no obvious method to lock folders, even administrators have no obvious way of locking folders. Locking folders could be important if you want to hide certain files or folders to prevent someone else from seeing them or altering the contents…
wrote, on February 5th, 2007
I better would not play with registeries.They really scare me
wrote, on February 5th, 2007
@Ashish Mohta
Oh ! “Practice makes perfect”
back up your register and set for the game…
wrote, on February 5th, 2007
oh thats a useful post .
and like u said going and editing registry is always thrilling.
and “practice makes perfect”.
wrote, on February 6th, 2007
Nice work and it’s really good.
wrote, on February 6th, 2007
It was really helpful. But i want to know how the file or folder can be made undeletable.
wrote, on February 6th, 2007
Sabarish: Did you try Recuva. Its Free!
wrote, on February 19th, 2007
how is the folder protected? is there a password or what? can anyone who got the accesibilety to the .bat files lock/unlock the folder?
wrote, on February 25th, 2007
I tried “Locking Drives:” method. but its not working for me. the drive still remains even i set d value. ( i set value 8 for d:\) but still i can see the drive even i set the value as 8. what i have to do? please help me.
Hiding folder option is working. it s really useful for me.
Thanks shankar .
Also tell me “21EC2020-3AEA-1069-A2DD-08002B30309D”.. how did u calculate this value? please tell me the way to calculate. thanks Friend
Aruna.S.K.S
wrote, on March 4th, 2007
[...] Tech-Buzz Share This | Read Comment (1) | Comments RSS | Top Tip: Get Paid To [...]
wrote, on March 13th, 2007
Shankar it works but problem is that you can see that folder content and also use their content. there are some tricks.
wrote, on April 4th, 2007
I want some useful regedit pl help me. I’m thanks ful you.
Dushyant
wrote, on April 14th, 2007
I did this and it worked.
But then I renamed the original file to check it.
I forgot to back up.
Then I renamed it back and it did not unlock after I
opened “key”.
Please help me as I need that folder asap.
My Email is MrKhurramSaeed@yahoo.com.au
Thanks in advance
wrote, on April 14th, 2007
saeed which file did u rename ? the .bat file or the folder itself ? can you explain your problem in detail ?
If u renamed your folder name make sure you rename again to the name that was placed before…
wrote, on April 30th, 2007
Thanks shankar .
Please tell me “21EC2020-3AEA-1069-A2DD-08002B30309Dâ€.. how did u calculate this value? please tell me the way to calculate. thanks Friend
wrote, on May 12th, 2007
[...] These softwares are only used when there is no way other way left to lock files. But my friend at TechBuzz has shown that you can easily lock your files and drives by using the following trick. The [...]
wrote, on May 13th, 2007
[...] These softwares are only used when there is no way other way left to lock files. But my friend at TechBuzz has shown that you can easily lock your files and drives by using the following trick. The best [...]
wrote, on May 13th, 2007
[...] These softwares are only used when there is no way other way left to lock files. But my friend at TechBuzz has shown that you can easily lock your files and drives by using the following trick. The best [...]
wrote, on May 23rd, 2007
[...] These softwares are only used when there is no way other way left to lock files. But my friend at TechBuzz has shown that you can easily lock your files and drives by using the following trick. The best [...]
wrote, on May 24th, 2007
[...] These softwares are only used when there is no way other way left to lock files. But my friend at TechBuzz has shown that you can easily lock your files and drives by using the following trick. The best [...]
wrote, on May 30th, 2007
That was very cool idea to lock foldrs.. but i want to lock folders also from registry…..
but you method lets users to delete that folder..
please send me an idea to lock folders from registry editor.
wrote, on June 25th, 2007
ok i was able to lock the folder but i was not succesful to unlock the folder . so i request you sir/mam to help me out as soon as possible
Thank you
wrote, on July 20th, 2007
go into console “Start - run - and type cmd”
if your locked folder on D:\ drive then type D:\, just hope that your tab is working. let just say that your folder was “test”, than you change into “test.{21EC2020-3AEA-1069-A2DD-08002B30309D}”. In this case if you open in explorer you will ended up into control panel. So, at the console just type “ren test” followed with tab button. Then you can see your full folder name. Continue with “test” then enter.
To lock drive i use the group policy editor. “start - run - gpedit.msc”
User Configuration - Administrative templates - Windows Component - Windows Explorer, on the right panel you’ll see the settings. You can set the Hide or Prevent access. Just double click, choose enable and pick your choice. thats all
wrote, on August 3rd, 2007
changing the registry is not recommended for end users , if something goes wrong while editing registry , creates more problems, it is better to use some tools folder lock
wrote, on August 3rd, 2007
It is better to use some freeware tools like folder lock , instead striking against registry for end users. Say if something goes wrong while editing the registry, it will create more problems
wrote, on September 14th, 2007
Nice work and it’s really good.
wrote, on October 16th, 2007
[...] These softwares are only used when there is no way other way left to lock files. But my friend at TechBuzz has shown that you can easily lock your files and drives by using the following trick. The best [...]
wrote, on November 8th, 2007
[...] read more | digg story [...]
wrote, on February 18th, 2008
[...] These softwares are only used when there is no way other way left to lock files. But my friend at TechBuzz has shown that you can easily lock your files and drives by using the following trick. The best [...]
wrote, on April 23rd, 2008
I tried to lock the folder using this tweak on Vista but it did’t work. Any solution for Vista users?
wrote, on May 26th, 2008
Hello.
I need lock drive a:+d:
Lock a: - normal ( value 1)
Lock d: - not work access is not blocked (value 8+1=9)
please help
Sorry my english
wrote, on August 29th, 2008
the loc.bat and key.bat file i made is not working here… does it requires any other procedures… i just did what you have post and nothing happens. it didnt lock my folder…
wrote, on September 1st, 2008
If you have the tools… A very useful tip.
wrote, on September 28th, 2008
[...] These softwares are only used when there is no way other way left to lock files. But my friend at TechBuzz has shown that you can easily lock your files and drives by using the following trick. The best [...]