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


Rate this post



February 5, 2015 at 12:38 am

I simply want to mention I am new to blogs and truly loved your blog. Probably I’m likely to bookmark your blog post . You absolutely have fabulous writings. Thanks a bunch for sharing your web site.


November 6, 2019 at 9:10 pm

but what if someone just opens the bat file and changes the password?

Rash Zaman

June 20, 2020 at 9:05 pm


I did this a few years ago to hide some documents on our home laptop. I now do not no where this is or what the file is called. How can i get these files back?


    December 30, 2020 at 3:33 pm

    Open folder options and enable hidden files option. Also, untick system protected operating system files

Aakash Ravi

April 12, 2021 at 5:54 pm


Just wanted to know what does “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” do and how do you get this.

Log out of this account

Leave a Reply