How to Lock Folder Through CMD




Introduction: How to Lock Folder Through CMD

About: Follow Me for A Gr8 Ride Of tech...

This Trick Will Show You That How To Lock Folder Through CMD.

I had Written Some Codes In Notepad and Save As .bat File To make It for a DOS.

The Codes are given in STEP:#3

The provided Codes has Some Parts in which the User's name and password is mentioned, so you can change that in your own way you want. (described in STEP:#3)


Follow ME To Know Some More Stuff Like this And Miscellanious Tips Nd HAcks...


LOVE CMD! oR NOTEPAD! (Uhhh...the Same thing till used as .bat)

(MS-DOS FOR BEGINNERS): I Would also Like to Mention That Batch Programming is the Easiest/Funniest & Interesting thing To Know About, so just try to read my codes line-by-line and just try to understand the way that codes carried out for their action otherwise Read Books For your Reference or Just Google And Follow Some Of the Best Forums, Blogs Nd all...

Step 1: #1

Step 2: #2

Step 3: #3



title Folder Locker

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

if NOT EXIST secured goto MDLOCKER


echo Are you sure u want to Lock the secured(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 secured "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"

attrib +h +s +r +i "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"

echo secured locked

goto End


echo put in the key to Unlock the lock

set/p "pass=>password"

if NOT %pass%==123456 goto FAIL

attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"

ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" secured

echo secured Unlocked

goto End


echo Invalid keyword



md Secured

echo lock unlocked

goto End


NOTE: In 23rd Line You can see the default password i.e., 123456 , so just change this to the password you want.

- So Just write The Codes In a same Way it is written And Save as "all file" type with file name lock.bat or anything.bat

OH! Wait! Some Of You Find it Difficult To write! i Guess, Okay! Download iT From here:

Step 4: #4

Step 5: #5 (See Description Too)

Bug: Some Of The Users Told Me That during This Step #5 when we lock the folder, the folder is still seen...

Bug Fixed: So Just Refresh (Press Ctrl+F5) it once in desktop or in the location where you are trying to lock that file...

Step 6: #6

5 People Made This Project!


  • Fix It! Contest

    Fix It! Contest
  • Creative Misuse Contest

    Creative Misuse Contest
  • Water Contest

    Water Contest

33 Discussions

Here the attrib is not recognized coming


1 year ago

if you could move it to another folder and when you unlock the folder it is in the same location as it was before the script

1 reply

like system32/drivers/etc

What if some tries to edit .bat file by right clicking -> edit.

now someone else can see our password and can even change it

2 replies

you can convert it to exe-file

You put in a whole lot of useless code that explodes their brain when they read it.

Hi i was wondering how you could change the name of the folder.

1 reply

ren "folder curret name" new name

how to know if its hidden or not? how do you check?

thanks i made it!

You're great man! Thanks a Lot!

I can't make it :(

this is unsafe all I have to do is open cmd in the same folder as the batch file (shift right click) and type attrib -s -h to view the files.

Hey i made a really good folder locker with VBScript, if anyone wants it email me at

how do I it to lock a folder

don't know what i would do without you