Easily Turn a Windows Folder into a Safe Using a Hidden Command

There are many different programs out there that allow you to protect files and information. However, there is an easy way to “lock” the contents of a folder on the Windows desktop by double-clicking on a file and without using third-party software.

To accomplish this task, we will create a folder and two batch files, one to lock the folder and one to unlock the folder.

To create the folder to contain the private files, right-click on the Desktop and select New | Folder from the popup menu.

NOTE: You can create a folder to contain your protected files anywhere. We’re just using the Desktop as an example.

Creating a folder on the desktop

Name the folder “safe” (without the quotes). You can name it something else if you want. You will just have to use the different name in the batch files you will create.

A folder called

Double-click on the new folder to open it and copy and paste any files you want to protect into the folder.

Adding files to the

The folder icon on the Desktop indicates there is at least one file in the folder.

Files added to the


To create the locking batch file, open Notepad and copy one of the following lines into a blank text file, depending on which version of Windows you are using.

Windows 7 and Vista:

ren safe safe.{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}

Windows XP:

ren safe safe.{FEF10DED-355E-4e06-9381-9B24D7F7CC88}

NOTE: If you used a name other than “safe” for the folder, replace “safe” in the batch file with the name of your folder.

Save the file as lock.bat.

Locking batch file created

To create the corresponding unlocking batch file, open Notepad and copy one of the following lines into a blank text file.

Windows 7 and Vista:

ren safe safe.{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}

Windows XP:

ren safe safe.{FEF10DED-355E-4e06-9381-9B24D7F7CC88}

Save the file as unlock.bat.

To lock and unlock the safe folder, the batch files must be located in the same place as the safe folder. Double-click on the lock.bat file to lock the folder. At first, the folder icon changes to an empty folder. If you press F5 to refresh your desktop (or in Windows Explorer), the icon for the folder changes to a lock. When you double-click on the locked folder, it will not open.

Changed icon for folder

To unlock the folder and access the files inside it, double-click on the unlock.bat file. The folder’s icon changes back to a folder with paper in it and double-clicking on the folder opens it.

The important thing to remember is that this method of locking a folder is not secure if you leave the lock.bat and unlock.bat files in the same location as the safe folder. You should move the two batch files to a separate location from the safe folder. Only copy the batch file you need to the same place as the safe folder when you need to lock or unlock the folder. Then, move it (or delete it, if you only copied it). Otherwise, anyone can access your protected data.

by Lori Kaufman

Comments [9]

  1. Useful trick but the author needs to reverse the order of the 'ren' command in the unlock.



  2. Hey, the folder is not getting unlocked!

    And I noticed that the two codes are not different at all! Are u sure it works??!

  3. I did a search and found your unlock code in the unlock.bat is not correct. FOR WINDOWS 7 It should be:

    ren safe.{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0} safe

  4. Also an even easier way is to winzip or winrar or 7zip your protected files (even set a password). Then (as long as the option "hide extensions for known file types" is off) rename your file to have NO extension. Like Safe.7z becomes Safe, Safe.rar becomes Safe, Safe.zip becomes Safe, in other words take the dot and everything to the right of the dot off the name. Much easier (though not as cool I admit) as the method described above.

  5. The unlock.bat is wrong.

    It should be:

    ren safe.{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0} safe


    ren safe.{FEF10DED-355E-4e06-9381-9B24D7F7CC88} safe

    Otherwise it actually works. Win7.

  6. What a palaver – and it sounds to me like anyone with half a brain could find the unlock batch file and double click it to unlock the folder anyway?

    I recommend TrueCrypt if you want a rather more secure way of keeping files away from prying eyes. It's excellent – and free for personal use too!

  7. You need to correct this page. The unlock on Windows 7, for example, is not "ren safe safe.{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}" but "ren safe.{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0} safe". In both instances, you gave the 'lock' text for both the 'lock' and 'unlock' text.

  8. The unlock file is wrong and won't work. It should be: "ren safe.{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0} safe".

  9. I tried doing this and it locked fine but wouldn't unlock. So I opened a Command prompt and ran unlock.bat only to find out that it can't find the file specified. I double checked the files and this article again to make sure I cut and pasted properly. Yep. Then I looked at the files and they were identical. The unlock.bat file should read : ren safe.{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0} safe . Now it'll work!

Leave a Reply

Your email address will not be published. Required fields are marked *