Thursday, January 10, 2013

Lock Files and Folders in Windows Without Extra Software

We have previously written about a utility used to lock files and folders in Windows, How to Protect and Lock Folders in Windows. Here is a method for locking files and folders without having to install a third-party software program.
Download the following text file, which contains the code for the batch file:
LockCode.txt
Open the file in Notepad. Replace “type your password here” in the LockCode.bat file with the password you want to use to lock and unlock the protected files and folders. DO NOT forget this password. Save the file as LockCode.bat.
NOTE: We realize this seems unsecure to enter your password in plain text into a text file, but this will be discussed later.
Text of LockCode.bat file
You should now have two files: LockCode.txt and LockCode.bat. If you cannot tell which file is which because the file extensions are not displaying, select Folder Options from the Tools menu in either My Computer or Windows Explorer.
Selecting Folder Options from the Tools menu
On the Folder Options dialog box, click the View tab, scroll down to the Hide extensions for known file types option and uncheck the check box.
Showing extensions for known file types
Now you should be able to see the extensions for both files.
File extensions on the files
Double-click on the LockCode.bat file to create a new folder named Locker. The new folder is created in the same directory as the LockCode.bat file.
Locker folder created
Place any files and other folders you want to protect into this Locker folder. Double-click the LockCode.bat shortcut on the desktop again to lock the Locker folder. You are asked if you are sure if you want to lock the folder. Type a Y if you are sure you want to lock the folder. The folder disappears.
Confirmation of locking the Locker folder
To unlock the Locker folder again, double-click on the LockCode.bat file. You are asked to enter your password.
Enter password
The folder is available again.
To make this a more secure option for locking files and folders, once you have locked the Locker folder, open the LockCode.bat file in Notepad and remove your password. You may either leave it blank or enter a dummy password. Only when you are ready to unlock your files and folders, should you open the LockCode.bat file again and re-enter your password and save the file again.
Then, you can double-click on the LockCode.bat file to unlock the Locker folder. If you don’t take this precaution, anyone can open your LockCode.bat file and view your password.
To open a .bat file in Notepad, you must open Notepad first. If you double-click on the file like you would if you were opening a text file, the file runs instead of opens.
Once Notepad is open, select Open from the File menu. Select All Files from the Files of type drop-down list to be able to see the LockCode.bat file. Then, you can click Open to open the file.
Opening a batch file in Notepad
To protect your password, you can also delete the LockCode.bat file and create it again from the original LockCode.txt file when you need to unlock your files.
NOTE: The LockCode.bat file MUST be in the same directory where the Locker folder was created originally for this method of locking files and folders to work