7 Steps to Lock a Folder (Plus a BONUS)

July 20, 2015 | Views: 6480

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATIONAlready a Member Login Here

7 Steps to Locking a Folder (Plus a BONUS)

1.Open Notepad. Copy and paste the code below:



title hacking

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


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%== coolhacks 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



2.Save the Notepad file as lock.bat (.bat extension is a must).

3. Double-click the lock.bat file and a folder called “MyFolder” will be created.

4. Copy the data you wish to secure into “MyFolder”.

5. Double-click the lock.bat file again and when the tcommand prompt appears, type “Y” and press Enter.

6. “MyFolder” will remain hidden from view and to access it, double-click lock.bat file.

7. You’ll be prompted for a password. The default password is coolhacks. To change the password replace coolhacks with new password in the above code.


BONUS: More Folder Security

You may be thinking that anyone could access the password by opening that lock.bat file in Notepad or any other text editor. To make this folder more secure, hide the lock.bat file in a highly secure location after following the above tutorial.

Then, to access the secured file double click on the lock.bat file. Consider copying the lock.bat file into a Pendrive and then copying it onto your computer whenever you need access to your protected files.

Share with Friends
Use Cybytes and
Tip the Author!
Share with Friends
Ready to share your knowledge and expertise?

  2. @sid is correct

  3. use folder lock

    or use cmd command “attrib +a +r +s +h foldername /s /d”

  4. its not working in windows 7

  5. not working for windows8 new folder is directly accessible some other folder is created.

Page 2 of 5«12345»
Comment on This

You must be logged in to post a comment.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Support Cybrary

Donate Here to Get This Month's Donor Badge


We recommend always using caution when following any link

Are you sure you want to continue?