How to Password Protect Folder in Windows without Software

You can password protect folders in Windows is easy using a bat file. Protecting your data into a locked and hidden folder in Windows for this you may using a third-party application but here you will see how password protect and hide your data without any software. There is a script for this, don’t worry you don’t have to be a coder and everything you need is available below. Using this trick you can create a password protected folders and hide it. To do that follow the simple steps that are mention below.

Snapshot of this guide

First create and bat file using script code given below. Run this bat file to create a folder. Place you content in this folder to protect it. Use .bat file to hide, folder by entering password.


Password Protect Folders in Windows

  • Create a new text document where you want to save your password protected folders. To create new text file, Right-click anywhere empty area and click “New” and then select “Text Document” option from the menu.
  • Open this newly created text document, copy the below given code and paste in this text document.
  • In this code replace the text YOUR_PASSWORD_HERE with your own password. This password will be used when you want to unlock the folder.

title Folder TrickyWays
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST TrickyWays 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 TrickyWays "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
echo Please Enter Password
set/p "pass=>"

 attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" TrickyWays
echo Folder Unlocked successfully
goto End
echo Invalid password
goto end
md TrickyWays
echo TrickyWays created successfully
goto End

  • After that click on “File” menu and select “Save As” option. Save your document as a bat extension like “lock.bat” and save the file.
  • Run this lock.bat file, it will create a new folder named TrickyWays. Put everything into this folder that you want to hide.
  • Now to hide this folder and password protect it, run lock.bat again and press Y to confirm and hide TrickyWays folder. Your folder is now hidden and protected.
  • To unlock and view this folder open lock.bat file but this time you have to enter the password that you replace while creating the bat file. Enter the password and hit enter. Your folder is visible and unlocked.

Anyone can view your .bat file code and of course your password as well. So to protect your password you can encrypt the code by converting your .bat file to .exe using different available tools, search bat to exe convertor in Google.

If you are the original author of this script code please contact us for attribution, we couldn’t find the correct author.

2 comments… add one
Mohammed Shariq December 18, 2015, 12:28 am

Awsome !dea…..

Paul February 15, 2018, 12:02 pm

Great… it would be great if find a encryption method without using any encryption software look like a Folder Lock or protected folder…

Leave a Comment

Join Our Subscribers

Receive the latest how-to guides, news, and updates from our team.

You have Successfully Subscribed!