Windows has no obvious method to lock folders, even administrators have no options to lock folders. Locking refers to preventing access to specific folders on the system. This can for instance be important if you have children who access the computer as well, so that they do not modify it in a way that breaks it or delete important data stored on it.
Locking folders can be easily done with just two batch files that protect the contents. This is no fool proof method of course and everyone who is computer savvy can reverse this easily. You need to create two text files, add one line of code to each and save them as .bat files so that they can be run on the system.
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)
Update: Newer versions of Windows come with options that improve this process a lot. Here are a couple of options that you have at your disposal:
Please click on the following link to open the newsletter signup page: Ghacks Newsletter Sign up
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.
Or you can just restrict access to those folders. But that’s less effective of course.
How about:
cacls FOLDER /R USER
This will prevent USER from ever accessing FOLDER. Alternatively you can do:
cacls FOLDER /G Administrator:F
This 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:F
The /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 DOMAINShyborg:F
Best way to do this is to look at another folder’s permissions and then replicate them on tour secret folder:
cacls OTHER_FOLDER
See 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