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. You never know what your children could do until they do, so better lock the important folders.
Locking folders can be easily done with just two batch files that protects the contents. This is no fool proof method of course and everyone who is computer savy is able to counter this. You need to create two textfiles, add one line of code to each and save them as .bat files to make them executable.
Add the following line to the first text file ren xxxx xxxx.{21EC2020-3AEA-1069-A2DD-08002B30309D} .Replace xxxx with the folder or drive name and save the file with the extension .bat, name it protect.bat for instance.
Now add the following line to the second text file and rename it unlock.bat. ren xxxx.{21EC2020-3AEA-1069-A2DD-08002B30309D} xxxx. Replace xxxx again with the orginal name of the folder.
To lock a folder just click on protect.bat, to unlock it again click unlock.bat
source: tech-buzz
Related posts:
Automatically Lock your computerUse USB Flash Drives To Lock Windows
Create Send To Entry for non-default printers
Colorize your Folders in Windows
Windows Tip: Don’t replace any files while copying
Lock your Devices with Device Lock
Clean Windows from all empty folders
Check the size of your folders


Or you can just restrict access to those folders. But that’s less effective of course.
How about:
cacls FOLDER /R USERThis will prevent USER from ever accessing FOLDER. Alternatively you can do:
cacls FOLDER /G Administrator:FThis will overwrite the default settings and make Administrator the only user allowed to touch it.
Hey! LUKE.. How can we undo the process???? i cant even access to my folder. wtf..
i used this command line “cacls FOLDER /G Administrator:F” then it locked my whole folder and now how should i Unlock it? I dont have any idea!
not sure but it could be cacls Folder /P User:F
This is pretty nice Luke, where did you find the information ?
I think I found this when I was trying to set up private folders on a WinXP Home box. The home edition does not have the permissions tab in the file properties dialog, so the only way you can set file permissions for individual users is via cacls.
Not sure where I found it exactly, but one of the best websites that explain all the windows command line commands is http://www.ss64.com/nt/
They cover all the build in stuff, as well as a lot of the stuff that comes in different Microsoft administrator kits and etc.
Shyborg, you would have to restore privledges for yourself – for example:
cacls FOLDER /E /G Shyborg:FThe /E switch means that you are editing the privs – not replacing them. If you are a part of a domain you may need to do:
cacls FOLDER /E /G DOMAIN\Shyborg:FBest way to do this is to look at another folder’s permissions and then replicate them on tour secret folder:
cacls OTHER_FOLDERSee which users have what permisions and just restore them using separate cacls commands. Don’t forget to use /E every time.
Good documentation of cacls is here: http://www.ss64.com/nt/cacls.html
Nice stuff, thanx