How to Lock a Folder in Windows 8/8.1 and 10
Privacy is a serious concern for some and computer’s are part of life for everyone. Many users have asked about how to protect/lock their data inside a folder the easy way so only they can access it. Some users cannot restrict their use of PCs to their family members and friends, or work colleagues and they may need to protect their data/folder, which is where a protected folder, locked to everyone except you comes handy.
In versions prior to Windows 8, this was not possible and people had to use 3rd party tools to achieve this. Lucky we are, to be alive in the reign of Windows 8/8.1 and 10 – where this is super easy.
Locking a Folder in Windows 8/8.1/10:
No third party software are needed to achieve this. Follow these simple steps. Navigate to the folder where the files you want to protect are present. Open the folder and right click inside the empty space to create a new text document. For this purpose, navigate to New > Text Document inside the contextual menu.
A new text file will be created as a result. You don’t need to name this file for now.
Double click the text file to open it in notepad and Paste the following code mentioned.
cls
@ECHO OFF
title Folder Locker
if EXIST “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” goto UNLOCK
if NOT EXIST Locker goto MDLOCKER
:CONFIRM
echo Are you sure u 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 Locker “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
attrib +h +s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
echo Folder locked
goto End
:UNLOCK
echo Enter password to Unlock folder
set/p “pass=>”
if NOT %pass%==Write-Password-Here goto FAIL
attrib -h -s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
ren “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” Locker
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Locker
echo Locker created successfully
goto End
:End
After pasting the code inside the text file, search for “Write-Password-Here” To save your time, you can press CTRL + F shortcut key combination on the keyboard and type “Write-Password-Here” inside the search field. Click on Find Next button to let it search for you. It would highlight the text you searched for. Replace the “Write Password-Here” text to any password you want to use to access the folder.
After typing your relevant password, click on File at the top left of the notepad application and select Save As. On the Save As window appearing after, move to the Save As type section and select the All Files from the list.
Change the name of the file by navigation to File name section and type “Folder Locker.bat” (without quotes). Then click Save. Double click the bat file and it would run the script to generate a new folder called Locker inside the same folder. Now, you can move the files you want to lock into this Locker folder.
Now, you need to open the bat file again. A command prompt will be launched as a result. Type Y inside the command prompt and hit Enter key. It would lock the folder as well as diminish the locked folder from the screen.
To unlock the folder, double click on the bat file again and type the password you entered before. In my case, I will type appuals and hit Enter key to get my locked folder back.
To lock the folder again, you need to repeat the steps from saving the Folder Locker.bat.