Lock any folder with a password without installing any apps

Apr 22, 2015 08:09 GMT  ·  By

Sharing a computer with someone might not seem like a good idea, because you sure have some files besides browsing history that you don’t want anyone to see. Sure, you can use third-party applications to add an extra layer of security, but isn’t it better to work with what Windows puts at your disposal?

Since everything relies on a handful of well-written lines of code, these can also be used to create a password-protected folder.

It might take a little more time than downloading a dedicated application, but this way you’re sure system registries remain intact and you’re never at risk of exceeding a trial period, crash your computer due to compatibility issues, or who knows what else. Enough talk though, here’s what you need to know:

Lock a folder in a matter of seconds

Step 1: Create a folder anywhere on your computer or even a removable disk drive.

Step 2: Use the context menu to create a new plain text document. Names are of no importance so you can use anything.

Step 3: Paste the following code inside your new document:

code
cls
@ECHO OFF
title Folder Private
if EXIST "HTG Locker" goto UNLOCK
if NOT EXIST Private goto MDLOCKER
:CONFIRM
echo Are you sure you want to lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Private "HTG Locker"
attrib +h +s "HTG Locker"
echo Folder locked
goto End
:UNLOCK
echo Enter password to unlock folder
set/p "pass=>"
if NOT %pass%== PASSWORD_GOES_HERE goto FAIL
attrib -h -s "HTG Locker"
ren "HTG Locker" Private
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Private
echo Private created successfully
goto End
:End
Step 4: Replace the PASSWORD_GOES_HERE string with the password you want to use. Also make sure to remember it.

Step 5: Save the file with the name Locker.bat. Write down the extension as well and make sure to select All Files type in the save dialog.

Step 6: Run the new batch file so that the Private folder is created.

Step 7: Place important or personal files inside the new folder.

Step 8: Run Locker.bat again and press Y. Don’t be scared that the new folder disappears, because this is supposed to happen.

Step 9: When you want to access files, just run Locker.bat and write down your password.

Once you go through the whole process, things don’t seem that complicated anymore. Here’s what else you can do for more protection:

Step 10: Right click on your Private folder to access the Properties panel.

Step 11: Tick the Hidden option to make it invisible. Hit Apply and OK to put changes in motion.

Making the folder visible again isn’t difficult and this is what you need to do:

Step 12: Access the Folder Options panel, either from the View menu, or sequentially pressing Alt, V, Y, O (in Windows 8).

Step 13: Switch to the View tab. Look for and tick Show hidden files, folders and drives under the Hidden files and folders category.

Whenever you want to change your password, just right-click the Locker.bat file, hit Edit and replace the old one. The method has been up on the web for some time, but it’s probably disregarded by most since it uses code writing. It’s not bulletproof, but it's a simple method to use if the one you're sharing the PC with is not the sharpest tool in the shed when in comes to computers.

On an ending note, this is a straightforward and basic way of adding an extra layer of security to folders. However, specialized applications like Folder Lock, or free alternatives such as Anvide Lock Folder, provide more options and tougher security measures.

Video steps to lock a folder in Windows (10 Images)

Protected folder
Create new text documentAdd your password
+7more