Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@ECHO OFF
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Private goto MDPrivate
:CONFIRM
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.
goto CONFIRM
:LOCK
ren Private "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to Unlock Your Secure Folder
set/p "pass=>"
if NOT %pass%== YOUR-PASSWORD goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDPrivate
md Private
echo Private created successfully
goto End
:End
@jhaggle

This comment has been minimized.

Copy link

@jhaggle jhaggle commented Oct 1, 2020

Not working

@vaishnaviasati

This comment has been minimized.

Copy link

@vaishnaviasati vaishnaviasati commented Oct 10, 2020

its working at my end

@Onyeka113

This comment has been minimized.

Copy link

@Onyeka113 Onyeka113 commented Oct 10, 2020

Its works thank you .

@dracotheking

This comment has been minimized.

Copy link

@dracotheking dracotheking commented Oct 18, 2020

it is working perfectly. it allows any password too.

@nehaa-a

This comment has been minimized.

Copy link

@nehaa-a nehaa-a commented Nov 1, 2020

It is working

@zaheer560

This comment has been minimized.

Copy link

@zaheer560 zaheer560 commented Nov 1, 2020

hey really it works

@Wilsonmobisa

This comment has been minimized.

Copy link

@Wilsonmobisa Wilsonmobisa commented Nov 4, 2020

Working so welll .. Huuuuh

@realregz

This comment has been minimized.

Copy link

@realregz realregz commented Nov 4, 2020

@madhan1939

This comment has been minimized.

Copy link

@madhan1939 madhan1939 commented Nov 16, 2020

Nice code.But, still the folders when you search with the folder name!!!

@jayesh1628

This comment has been minimized.

Copy link

@jayesh1628 jayesh1628 commented Nov 16, 2020

@LjayZeee

This comment has been minimized.

Copy link

@LjayZeee LjayZeee commented Nov 16, 2020

The files are not totally hidden, it could be search in the search bar and as well as at the recent files. Also, the .bat file if you right click on it, it could be edit and see the password.
But It works and helpful.

@Wilsonmobisa

This comment has been minimized.

Copy link

@Wilsonmobisa Wilsonmobisa commented Nov 18, 2020

@Aasim344

This comment has been minimized.

Copy link

@Aasim344 Aasim344 commented Dec 17, 2020

it's not working

@Iw0o0

This comment has been minimized.

Copy link

@Iw0o0 Iw0o0 commented Jan 30, 2021

hehe nice, now i won't be signed out from my family inheritance for sure, thanks a lot! :D

@Future-Gamer2041

This comment has been minimized.

Copy link

@Future-Gamer2041 Future-Gamer2041 commented Feb 15, 2021

It is awesome

@Future-Gamer2041

This comment has been minimized.

Copy link

@Future-Gamer2041 Future-Gamer2041 commented Feb 15, 2021

Not working

no it working just fine

@Benjote

This comment has been minimized.

Copy link

@Benjote Benjote commented Mar 1, 2021

Nice

@Muhammad-Sameer-Ansari

This comment has been minimized.

Copy link

@Muhammad-Sameer-Ansari Muhammad-Sameer-Ansari commented Mar 11, 2021

great job, thanks.

@1Karan1

This comment has been minimized.

Copy link

@1Karan1 1Karan1 commented Apr 2, 2021

working fine, thanks.

@KingsDemise

This comment has been minimized.

Copy link

@KingsDemise KingsDemise commented Apr 7, 2021

It's not foolproof, anyone can make another bat file and delete the previous one, edit it and change the password and voila!

@bhavya1415

This comment has been minimized.

Copy link

@bhavya1415 bhavya1415 commented Apr 12, 2021

It isn't working. It created the private folder and when I entered the password in the console the private folder isn't showing up. Please someone help me as that folder contains very imp. files

@MrLagag

This comment has been minimized.

Copy link

@MrLagag MrLagag commented Apr 14, 2021

Thanks it works perfectly for me I think it is very effective for my privacy Thanks so much for posting this I love it Yeetus

@Muhammad-Sameer-Ansari

This comment has been minimized.

Copy link

@Muhammad-Sameer-Ansari Muhammad-Sameer-Ansari commented Apr 15, 2021

@Pradyumna02010

This comment has been minimized.

Copy link

@Pradyumna02010 Pradyumna02010 commented Apr 17, 2021

Thanks

@MrLagag

This comment has been minimized.

Copy link

@MrLagag MrLagag commented Apr 17, 2021

yeah it seems to be working but we need a feature that let us chose our own Name for the private file and it need to be un editable because when u edit it u can change the Password if cannot do so that's alright

@sielhadi

This comment has been minimized.

Copy link

@sielhadi sielhadi commented Apr 23, 2021

it works thank you

@BrownBlackBlues

This comment has been minimized.

Copy link

@BrownBlackBlues BrownBlackBlues commented Apr 23, 2021

To completely hide your documents, images or folder, create a bat file as suggested with a password. Since you can right click and see the password, DELETE the bat file in the folder so it 'doesn't exist' in the folder and cannot be accessed, but remember the name of the bat file or record it down somewhere other than in the folder. In order to access the bat file again, simply create a new bat file with the SAME name. Double click, enter password as normal. You can have some unimportant documents or images in the folder to make it seem it's a real folder.
Test this out before attempting it with important documents please. It works for me in Win10 but I haven't tried it out on an external HD or Passport! Good luck!

@ImmortalTerror

This comment has been minimized.

Copy link

@ImmortalTerror ImmortalTerror commented Apr 27, 2021

To completely hide your documents, images or folder, create a bat file as suggested with a password. Since you can right click and see the password, DELETE the bat file in the folder so it 'doesn't exist' in the folder and cannot be accessed, but remember the name of the bat file or record it down somewhere other than in the folder. In order to access the bat file again, simply create a new bat file with the SAME name. Double click, enter password as normal. You can have some unimportant documents or images in the folder to make it seem it's a real folder.
Test this out before attempting it with important documents please. It works for me in Win10 but I haven't tried it out on an external HD or Passport! Good luck!

You could also just use cmd to lock it and unlock it. Just remember were it is and what it's called.

Lock: ren FOLDERNAME "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" & attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"

Unlock: attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" & ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" FOLDERNAME

@arbagdi5050

This comment has been minimized.

Copy link

@arbagdi5050 arbagdi5050 commented May 1, 2021

It is amazing, properly working on my end but what happens when the .bat file does not exist.
And what should we do in case of someone forgot the password could we recover again and change it.

@BrownBlackBlues

This comment has been minimized.

Copy link

@BrownBlackBlues BrownBlackBlues commented May 2, 2021

It is amazing, properly working on my end but what happens when the .bat file does not exist.
And what should we do in case of someone forgot the password could we recover again and change it.

The whole idea is to make the .bat file 'disappear' so nobody can right click > click edit and see the password. You have to remember where the .bat file and more importantly the exact name, or you lose the file permanently.
Another simple method to hide password in .bat file is to right click > click edit > delete visible password > click save. Now you have the .bat file visible but right clicking and clicking edit will not show the password. You can still access the file the normal way using the password you deleted. Only difference now is, anyone trying to access the password through 'edit' will not see the password.

@Anik987

This comment has been minimized.

Copy link

@Anik987 Anik987 commented May 7, 2021

It is working..Thanks

@Abhiram405

This comment has been minimized.

Copy link

@Abhiram405 Abhiram405 commented May 8, 2021

Please help everything in the folder got deleted.....please help i beg you

@ImmortalTerror

This comment has been minimized.

Copy link

@ImmortalTerror ImmortalTerror commented May 8, 2021

Please help everything in the folder got deleted.....please help i beg you

Check your recycling bin

@ImmortalTerror

This comment has been minimized.

Copy link

@ImmortalTerror ImmortalTerror commented May 8, 2021

If its not there enable hidden items
image

@loathsomeguy

This comment has been minimized.

Copy link

@loathsomeguy loathsomeguy commented May 21, 2021

it's working.
tested...

@AbbbasAlhashimi

This comment has been minimized.

Copy link

@AbbbasAlhashimi AbbbasAlhashimi commented Jun 6, 2021

Is it effective against ransomware?

@Itzmesan

This comment has been minimized.

Copy link

@Itzmesan Itzmesan commented Jun 10, 2021

I have locked Docs
After locking , it is easily getting opened through control panel..? Any suggestions
Helpme through this .

@Adithya2009

This comment has been minimized.

Copy link

@Adithya2009 Adithya2009 commented Jun 13, 2021

It Works its Amazing Thanks

@yudhosetyo

This comment has been minimized.

Copy link

@yudhosetyo yudhosetyo commented Jun 15, 2021

for example, I moved txt file named asdf.txt on private folder. After locking, I tried searching it in win explorer search box. OMG I found it include the folder location :D

@NGKAHOU1998

This comment has been minimized.

Copy link

@NGKAHOU1998 NGKAHOU1998 commented Jun 16, 2021

Great work!

@ghousenoor2212

This comment has been minimized.

Copy link

@ghousenoor2212 ghousenoor2212 commented Jun 17, 2021

@ian131

This comment has been minimized.

Copy link

@ian131 ian131 commented Jun 17, 2021

guys pls help me i lost my files form private folder dk where they are not in recycle bin nor in hidden , pls help me they are very important

@ian131

This comment has been minimized.

Copy link

@ian131 ian131 commented Jun 18, 2021

guys pls help me i lost my files form private folder dk where they are not in recycle bin nor in hidden , pls help me they are very important

pls help me guys

@yudhosetyo

This comment has been minimized.

Copy link

@yudhosetyo yudhosetyo commented Jun 18, 2021

guys pls help me i lost my files form private folder dk where they are not in recycle bin nor in hidden , pls help me they are very important

pls help me guys

Hi, please go to folder options > view tab > uncheck Hide protected operating system files (recommended). Then enter "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" on search box.

@YeabsiraBeyene

This comment has been minimized.

Copy link

@YeabsiraBeyene YeabsiraBeyene commented Jun 23, 2021

It works just watch this video: https://www.youtube.com/watch?v=bQDHc9GFILE

@satyamjhadps1

This comment has been minimized.

Copy link

@satyamjhadps1 satyamjhadps1 commented Jun 28, 2021

THE BEST THING EVER SAW!!!!!!!!!

@avatarlouie

This comment has been minimized.

Copy link

@avatarlouie avatarlouie commented Jun 29, 2021

Just tried this! It works for the Windows File structure, on one's computer. But if the folder is shared, then the file that the code originally hid, "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}", becomes visible. So, I think when it comes to file sharing, another layer of protection, via a file-sharing password is needed.

@avatarlouie

This comment has been minimized.

Copy link

@avatarlouie avatarlouie commented Jun 29, 2021

guys pls help me i lost my files form private folder dk where they are not in recycle bin nor in hidden , pls help me they are very important

pls help me guys

Hi, please go to folder options > view tab > uncheck Hide protected operating system files (recommended). Then enter "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" on search box.

You can also copy-paste the whole folder on Microsoft Onedrive, and then open Onedrive on your browser, unless there are bugs!

@shivu1231

This comment has been minimized.

Copy link

@shivu1231 shivu1231 commented Jul 16, 2021

Not working

Working for me tho... check if u used it correctly

@hr097

This comment has been minimized.

Copy link

@hr097 hr097 commented Jul 26, 2021

Superb it's working but I recommend to follow the step given in You tube video.

@AravSingh26

This comment has been minimized.

Copy link

@AravSingh26 AravSingh26 commented Jul 28, 2021

Not working

its working at my end too just rechk the mistakes u doin man

@Dominic239

This comment has been minimized.

Copy link

@Dominic239 Dominic239 commented Jul 30, 2021

working for me

@TheMeanboy

This comment has been minimized.

Copy link

@TheMeanboy TheMeanboy commented Aug 2, 2021

Working fine, but what about password reset or forget?

@Shreyan-proggra

This comment has been minimized.

Copy link

@Shreyan-proggra Shreyan-proggra commented Aug 2, 2021

It's working fine

@NirodK

This comment has been minimized.

Copy link

@NirodK NirodK commented Aug 16, 2021

How I can recover my password if I forgot and locked the folder ? please help. TIA

@nishthaneeraj

This comment has been minimized.

Copy link

@nishthaneeraj nishthaneeraj commented Aug 16, 2021

Right Click On the FolderLock.bat file and open with notepad (Or any other text editor you want) and then on line 21 you will find your password
if NOT %pass%== YOUR-PASSWORD goto FAIL

@Tej-Singh-Rana

This comment has been minimized.

Copy link

@Tej-Singh-Rana Tej-Singh-Rana commented Aug 17, 2021

How I can recover my password if I forgot and locked the folder ? please help. TIA

https://gist.github.com/pknowledge/1feef32fa21475eb9742ea247aefe1af#file-folderlock-bat-L21

@procoderalamin

This comment has been minimized.

Copy link

@procoderalamin procoderalamin commented Aug 18, 2021

Thanks a lot. that awesome code for lock any file

@MrLagag

This comment has been minimized.

Copy link

@MrLagag MrLagag commented Aug 27, 2021

@cxlines

This comment has been minimized.

Copy link

@cxlines cxlines commented Aug 29, 2021

Thank you bro:)

@nazmulrahman

This comment has been minimized.

Copy link

@nazmulrahman nazmulrahman commented Aug 29, 2021

if you don't know the password and want unlock :

just simply rename the ".bat" file to ".txt".
enter the file
you can see the password.
again rename the file to ".bat",
enter, type the password

@aman7778

This comment has been minimized.

Copy link

@aman7778 aman7778 commented Sep 12, 2021

It comes as a surprise to me how no one is talking about accessing the locked files using web browser (file:///C:/). This method of hiding files is completely flawed.

@BrownBlackBlues

This comment has been minimized.

Copy link

@BrownBlackBlues BrownBlackBlues commented Sep 13, 2021

@aman7778

This comment has been minimized.

Copy link

@aman7778 aman7778 commented Sep 13, 2021

...maybe it's because the majority of those using the PC or 'accessing the locked files' don't know the meaning of (file:///C:/) let alone how to use it, me included. Maybe you can elaborate?

Just open any web browser like Chrome, MS Edge etc. and in the address bar type file:///C:/ and hit enter. This will open the C: drive of your PC. Navigate to that bat folder (if it's in C drive) and you'll find the locked folder completely visible and accessable without any prompt for password. For opening any other drive, just replace C with the respective drive letter in file:///C:/. In short, when using your web browser as file explorer, the locked folder isn't locked and its contents can be downloaded to the download directory of browser like copy-paste from where you can directly open the file.

@BrownBlackBlues

This comment has been minimized.

Copy link

@BrownBlackBlues BrownBlackBlues commented Sep 14, 2021

@BrownBlackBlues

This comment has been minimized.

Copy link

@BrownBlackBlues BrownBlackBlues commented Sep 14, 2021

@aman7778

This comment has been minimized.

Copy link

@aman7778 aman7778 commented Sep 14, 2021

Just tried it. It only shows the .bat file. Clicking on it opens the txt page where your password is located, like how you do when you 'right click>edit' the .bat file. It does not expose the contents of the folder. This is how I did it... Chrome> file:///C:/>Users>Dell>Documents>.bat[name]

On Mon, Sep 13, 2021 at 9:43 PM aman7778 @.> wrote: @.* commented on this gist. ------------------------------ ...maybe it's because the majority of those using the PC or 'accessing the locked files' don't know the meaning of (file:///C:/) let alone how to use it, me included. Maybe you can elaborate? Just open any web browser like Chrome, MS Edge etc. and in the address bar type file:///C:/ and hit enter. This will open the C: drive of your PC. Navigate to that bat folder (if it's in C drive) and you'll find the locked folder completely visible and accessable without any prompt for password. For opening any other drive, just replace C with the respective drive letter in file:///C:/. In short, when using your web browser as file explorer, the locked folder isn't locked. — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://gist.github.com/1feef32fa21475eb9742ea247aefe1af#gistcomment-3891382, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATZ6DLXNL6K6ULULNFQ5MFLUBX5YFANCNFSM4SBAJBCQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

In the same directory where the .bat file is located, isn't there a folder named CONTROL PANEL...just above the .bat file? If it was there, you had to open that folder to access the locked files.

@BrownBlackBlues

This comment has been minimized.

Copy link

@BrownBlackBlues BrownBlackBlues commented Sep 14, 2021

@samisk01

This comment has been minimized.

Copy link

@samisk01 samisk01 commented Sep 24, 2021

Guys Please help.
I used this and locked my 300GB data in my external HD. Now I have forgotten my password. How can I find my password or retrieve my data? Please help

@BrownBlackBlues

This comment has been minimized.

Copy link

@BrownBlackBlues BrownBlackBlues commented Sep 24, 2021

@samisk01

This comment has been minimized.

Copy link

@samisk01 samisk01 commented Sep 24, 2021

Thank u BrownBlackBlues!
The issue is that I got the password but the folder it gives me is empty while when I see the properties of my HD, it shows 7GB free out of 250GB. now what?

@BrownBlackBlues

This comment has been minimized.

Copy link

@BrownBlackBlues BrownBlackBlues commented Sep 24, 2021

@samisk01

This comment has been minimized.

Copy link

@samisk01 samisk01 commented Sep 28, 2021

@BrownBlackBlues

This comment has been minimized.

Copy link

@BrownBlackBlues BrownBlackBlues commented Oct 1, 2021

@sriharshaseelam

This comment has been minimized.

Copy link

@sriharshaseelam sriharshaseelam commented Oct 4, 2021

works fine for me

@BleEthan

This comment has been minimized.

Copy link

@BleEthan BleEthan commented Oct 11, 2021

Is there a file size limit? There seems to be one for me.

@unknown2832021

This comment has been minimized.

Copy link

@unknown2832021 unknown2832021 commented Nov 16, 2021

It's so simple and easy how the way it works. Thank you for sharing this acknowledgement.

@MrLagag

This comment has been minimized.

Copy link

@MrLagag MrLagag commented Nov 29, 2021

@MrLagag

This comment has been minimized.

Copy link

@MrLagag MrLagag commented Nov 29, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment