Batch file to lock access to a folder on your desktop to everyone

Windwos 7 hacksIn this article we will demonstrate how you can lock and unlock access to a folder on your desktop or Windows machine using a batch file. When the folder is locked and if anyone tries to access it, they would not get any error message but will not be able to access it. This is not the same as locking a folder using the "Deny All" NTFS permission, which can be very dangerous and harmful at times. This trick comes in very handy if you share your computer desktop and logon with someone and want to keep them from snooping in to your private things. This is a very cool and almost harmless Windows 7 hacks, if you would like to see other cool Windows 7 hacks, you can check out the Windows 7 God Mode.

We will be using two batch files, one to lock access and the second to unlock it. Please make sure you keep the batch files at the same location to begin, where you created your locked folder

1. To begin with, create a new empty folder on your Windows 7 desktop and rename it to be called "lockedfolder" (without the quotes).

2. Create the batch file that will be used to lock the folder, to do so copy everything in between dotted lines below and paste it on NotePad.

---------------------------------------------------------------
@echo off
REM This batch file will lock access to a folder on your desktop called lockedfolder
ren lockedfolder lockedfolder.{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}
---------------------------------------------------------------

3. Save the Notepad file as lockit.bat and save it in the same location where you created your locked folder (eg; the Desktop)

4. Create the batch file that will be used to unlock the folder, to do so copy everything in between dotted lines below and paste it on NotePad.

---------------------------------------------------------------
@echo off
REM This batch file will unlock access to a folder on your desktop called lockedfolder
ren lockedfolder.{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0} lockedfolder
---------------------------------------------------------------

5. Save the Notepad file as unlockit.bat and save it in the same location where you created your locked folder (eg; the Desktop)

6. Now try it, double click the lockit.bat file to lock the folder and try accessing it, you will not be able to access it.

7. Now unlock the folder by double clicking the unlockit.bat file and accessing it, you should now be able to access it normally.

The only one note of caution is to remove the unlockit.bat file from a visible location to your shared user, so that they can't use it to unlock the folder.

Hope you liked this cool trick! If you want to share your ideas, or simply want to provide feedback, you can always contact us by leaving us a comment here or by using the  Contact Us form