Make password protected folder using batch script

Make password protected folder using batch script

Hi, interesting and useful trick to password protect folder without using any software using batch file programming.


There are a lot of methods are available that you can use to create a password protected folder. Most of them require the use of some third party software. Using this neat method you can hide your folders with a quick batch script.

It’s important to note that this will not actually conceal your data from somebody who knows what they are doing.


1. Open Notepad and Copy code given below into it.


if EXIST “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” goto UNLOCK
if NOT EXIST MyFolder goto MDMyFolder
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.
ren MyFolder “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
attrib +h +s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
echo Folder locked
goto End
echo Enter password to Unlock Your Secure Folder
set/p “pass=>”
if NOT %pass%== techipick goto FAIL
attrib -h -s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
ren “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” MyFolder
echo Folder Unlocked successfully
goto End
echo Invalid password
goto end
md MyFolder
echo MyFolder created successfully
goto End

Here I’ve used password as techipick (See bold text). You may change it with your own password.

2. Save the notepad file as lock.bat (.bat is must)
3. Now double click on lock.bat and a new folder will be created with name MyFolder
4. Copy all your data you want to protect in that New folder
5. Now double click on lock.bat and when command promp appears Type Y and press enter.
6. Now MyFolder will be hidden from you view, to access that folde double click on lock.bat
7. It will ask for password enter your password and done.
Note: To change the password replace techipick with new password in the above code


Super hiding files using command prompt

Super hidden files are not visible to users even if the visibility of hidden files are enabled. You can make a hidden system file using cmd and usually common people does not go for changing settings to enable visibility for system files. This method simply hides your files.


1. Open command prompt with elevated privileges (ie, right click on it and run as administrator) and type the below code

attrib +h +s

“h” is for hiding and “s” is for making it as system file.

2. Copy the file location and paste it in the command prompt.
Hint: Right click and take properties of the file. There you will get its location

Here location of the folder “photos” is D:\Documents\College


3. Now, copy the location right click and choose paste to paste it in the Command prompt.

You have to add \photos at the end of above location to point to original folder as below



4. Hit enter. Now your folder is super hided!

You can hide specific images, documents etc by this method. for that you should use its extension at the end like imagename.jpg

How to unhide?
Its simple. Just change “+” with “-” in the above code as shown below

attrib +h +s D:\Documents\College\photos

This method doesnot hide your folder completely. To view this superhidden files, untick the option “Hide protected operating system files” from folder options.