How to Password Protect Files

Here is how you can Password-Protect Files on Windows 10

If you use a shared a computer with others and have some data which you wish to keep confidential, you may have thought about somehow protecting your files with a password to protect them from prying eyes. This tutorial outlines how this can be achieved on Windows 10. Windows 10 does not have built-in functionality for the password protection of files like Windows 7 did. However, through the method described below password protection can be achieved on Windows 10 as well.

  1. First, go to the folder which you wish to protect with a password and create a new empty text file. You may name this folder whatever you want, I’ll be using the name “xyz”

  2. In this folder, copy and paste the code given below and add the password which you wish to set after the text “if NOT %pass%==”. The exact position has been marked by Bold text in the code given below, as referenced from here.
@ECHO OFF

if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK

if NOT EXIST Private goto MDPrivate

:CONFIRM

echo Are you sure to lock this 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 "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 Your Secure Folder

set/p "pass=>"

if NOT %pass%== YOUR-PASSWORD goto FAIL

attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"

ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private

echo Folder Unlocked successfully

goto End

:FAIL

echo Invalid password

goto end

:MDPrivate

md Private

echo Private created successfully

goto End

:End

I have set my password as “1234” you may choose your own password. Make sure to give a space after the “==” sign and before the “goto FAIL” text as shown in the image above

    1. Once you are done with step 2, save the file but change the file extension from .txt to .bat
    2. Click on the bat folder and it will automatically create a folder named “Private” for you

 

  1. Then move all the files you wish to protect into the private folder.
  2. Click on the batch file and enter “Y” when you are asked for confirmation
  3. Once you do this, your private folder will be hidden and the only way to access it will be by entering the password you initially set by clicking on the .bat folder

And just by following these simple steps, you will be able to hide and secure any form of data be it pictures, documents videos etc. However, once you unlock your private folder you must remember to re-lock it again by following the steps outlined above.