How to password protect files and folders on Windows 7 and 8?

Password protection is really important when it comes to personal and private documents, which are meant not to be shared with anyone using your computer. You can protect files in many ways, but I would always prefer to do it without using any third party softwares, because you never know the authenticity of these tools. So the method we would be talking about here is will be done with the help of a script, which is error-free and is very efficient. All you’ll need is a password to unlock the folder, in which all your documents will be contained. And before entering the password, the user cannot even see the folder, so it’s very safe. So let’s get started. Please Note: “Virtuaniz” or the author is not responsible for any loss of documents or files because of any error on the users’ end.

Step 1: Create a folder which will contain all your documents and files which you wish to protect.

Step 2: Open an empty notepad file (press Windows key + R and then type ‘notepad’ and hit enter). Paste the following code in the notepad pad file and save the file as “locker.bat” in the same folder which contains all your files.



title Folder Private

if EXIST “HTG Locker” goto UNLOCK

if NOT EXIST Private goto MDLOCKER


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.



ren Private “Virtuaniz Locker”

attrib +h +s “Vituaniz Locker”

echo Folder locked

goto End


echo Enter password to unlock folder

set/p “pass=>”


attrib -h -s “Virtuaniz Locker”

ren “Virtuaniz Locker” Private

echo Folder Unlocked successfully

goto End


echo Invalid password

goto end


md Private

echo Private created successfully

goto End


Replace ‘PASSWORD_GOES_HERE’ with a password of your choice.

Step 3: The “locker.bat” file will get created. Now click on that, which will create a folder called ‘Private’ will be created. Now you can shift all your files to the private folder. Make sure there are no traces of the files outside.

Step 4: Click on “locker.bat” file again, now it will ask whether you want to lock the folder or not. To lock the folder enter “y” and hit enter.

Step 5: You’re done! But make sure that you have unchecked “show hidden files/folders” option. To get your files, open “locker.bat” and enter the password you have chosen.


comments powered by Disqus