How To: Lock Folder Without Any Software with Password

Lock Folder Without Any Software with Password

You can easily lock any folder on your Windows computer with a simple Notepad hack. By creating a batch file, you can hide a folder and require a password be entered before it becomes visible and accessible. This is a great tool for locking sensitive information, like pictures, financial statements, and a lot more.

This trick will work on just about any version of the operating system, including Windows 10, Windows 7, Windows XP, Windows 98, and so on.

Step 1: Open Notepad

Start by opening Notepad, either from search, the Start Menu, or simply right-click inside a folder, then choose New -> Text Document.

Step 2: Add Code to Document

Now just copy the text below and paste it into your document.

@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%== wonderhowtogoto 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

Step 3: Edit Folder Name & Password

With the text pasted in, you can adjust the locked folder's name, as well as the password used to unlock it. The default folder name is "Private" and the default password is "wonderhowto."

Step 4: Save Batch File

Now save the file as whatever name you'd like, but make sure the name ends in ".bat" and that you select "All files" in the drop-down box when saving. Also, if you opened Notepad directly rather than using the right-click, be sure to adjust your save location accordingly.

Once saved, your file should look like this in the folder you choose:

Step 5: Create Folder

Now double-click on the batch file you just created (or select and hit Enter). You'll notice a new folder come up.

At this point, you can start adding files to this folder. Don't worry, you can always add to remove files from it later.

Step 6: Lock the Folder

Once you're ready to lock the folder, simply double-click on the batch file (or select and hit Enter), then choose 'y' on the window that pops up and hit Enter.

You'll notice that your folder has now disappeared.

Step 7: Access Your Hidden & Locked Folder

Now whenever you need access to your folder, just double-click on the batch file, input your password, and hit Enter.

To re-lock (and hide) the folder, just hit the batch file again. And remember, you can name the batch file and folder whatever you like, you feel free to make sure of this trick in multiple locations on your Windows machine.

Just updated your iPhone? You'll find new features for TV, Messages, News, and Shortcuts, as well as important bug fixes and security patches. Find out what's new and changed on your iPhone with the iOS 17.6 update.

Cover image and screenshots via WonderHowTo

69 Comments

how is this good, cuz when i create bat file, the folder still appears and it's still accessible. Did i do it wrong

just again double click on batch file and it will ask you to lock or not? then press 'y' or 'Y' and your folder will disappear. you can refresh your computer to hide folder.

Any tips on how I can lock the entire drive c:\ including all files and folders?

Thanks guys!

But i am not able to apply lock on a shared folder. How can i make a shared folder password protected?

I had the same issue. The folder is renamed, but by clicking on it, it still shows it contents and even the content is accesible..

edit:
never mind, I get the point of this line of code now.

@Jason: This line of code will hide the folder, not locking it. So if the option "show hidden folders" (dont know the exact name) is on, you will still be able to access it.

If that is the case.
attrib +h
This command should be enough.

It's a nice trick! tried using it but some programs couldn't be accessed that were in the folder i copied to the Myfolder...

many time i refresh and run batch file but folder still appers and accessible.
how can i secure my folder.?

Yeah man it will work fine. But you need to store your password some where else so no one can see it by right-click >> edit

It's really lock my files but I have one problem that is when I enter wrong password, it opens. so how I say that my file is secure. Anyone can access my file. please help me........

You have to put space between the password and goto . The arrow will show you.

can i change the password??

You can change the password by instead of typing Hello1 type your desired password .

but the person you have hiding the files can know your password by editing it and he/she see the password ....LOOK AT THE PICTURE!

erase the Hello1 and write your desired password . THANKU.

theres also this option:

after making this .bat you can hide the folder ( right click and hide the folder like normal) now its no visible, you can find it if you know its there and make it visible again but well. now you got a bat file with a password and a hidden folder :)

@echo off
msg Stay out!
@echo off
title Folder Password v1.5
color 1f
set password= write your password here
:top
echo.
echo ----------------------------------------------
echo.
echo Folder Password
echo.
echo ----------------------------------------------
echo You have %tries% attempts left.
echo Enter password
echo ----------------------------------------------
set /p pass=
if %pass%==%password% (
goto correct
)
set /a tries=%tries -1
if %tries%==0 (
goto penalty
)
cls
goto top
:penalty
echo Sorry, too many incorrect passwords, initiating shutdown.
start shutdown -s -f -t 35 -c "SHUTDOWN INITIATED"
pause
exit
:correct
cls
echo ----------------------------------------------
echo Password Accepted!
echo.
echo Opening Folder...
echo ----------------------------------------------
explorer E:\path of folder/file here
pause

Yeah but if you accidentally enter in the wrong password it shuts down your pc which I wouldn't use this one

It insent really a language, batch files just run the command in the prompt.

hello, i tried doing this as expained above and it worked but after some few hour later i could no longer see my files even if i use the password!..

please help! what should i do to recover them??
thnaks

go on search tab on that folder and search for your files, it will recover your files........

Bro?? same happened to me pls help me recover my data it very important :'(((

To answer anyone's question about this @Prashant Agarrwal "It's really lock my files but I have one problem that is when I enter wrong password, it opens. so how I say that my file is secure. Anyone can access my file. please help me........" As you can see in the picture on line 22 It originally says if NOT %pass%== Hello1goto FAIL

were it says "Hello1goto Fail" most people think that "goto" after Fail is apart of the password, and its not you must put a space between Hello1, and goto, now on line 21 it says

set/p "pass=>"
after that you must put your password so for example
set/p "pass=>" P@ssword112
I hope this helps many of you that have the same problem that I had

Thanks , It is working.

Hi i just tried that one and I almost got it now my file is disappeared I can't reach my file now what should I do pls reply even that locker.bat isn't working then where will I get my folder.... Pls help me out

hey how did you get it recovered?? i lost all my data inside

if you move the locker.bat to somewhere else and try to open the folder, the files are no more there. but when i returned the locker.bat to the original location, contents of the folder were visible. How can I hide the locker.bat file in a different location without loosing the contents of the folder?

Query:

  1. No password required when anyone delete Locker.bat(Secure File)
  2. Anyone access Locker.bat, Open my folder by given any password.

Kindly Provide Proper solution

I HAVE CREATED THE FOLDER ,NOW I WANT TO CHANGE PASSWORD,BUT UN ABLE TO DO SO ,PL SUGGEST

i think this is not safe as there is one password created by you and another master password LOCK which is common and any one can access file with LOCK (password)

i can not open the folderlocker folder and my files are there. i dont know to get enter to this folder . help me .

hi

But it wil not work when click on the hidden button that is present in view , It will til hide your folder till hidden button is not clicked

It works fine. What if I unfortunately delete that locker.bat file???

FolderLocker.bat or Locker.bat is a batch file. As we know that this locker work same as like any other locker software. But it have some demerit.

Demerit are:

No password required when anyone delete Locker.bat(Secure File)Anyone access Locker.bat, Open locker folder by given any password.

This batch file (Locker.bat) Create Folder in which we can put some files or folder to lock them under password protection. We can hide or unhide the locked file by double click on this batch file.

Your question:
What if when batch file (locker.bat) is deleted unfortunately.

Solution:

If you or someone delete the locker.bat file, then only this batch file will be deleted. Locker folder in which you have locked your file and folder will not be deleted. This locker will remain hide position in same drive of your computer system. This can recover when you recreate same batch file with same name and coding (locker.bat). Locker folder will reappear on same drive or folder.

To make more secure you can also hide or unhide the .bat file also from "Show Hidden file or Hide file" option which is present in view menu of window explorer.

it is not totally secure as if you delete locker.bat file your folder is open. am i right admin ?

Very good trick but if I off the Show hidden files, folders, and drives AND Hide protected operating system files (recommended) then hidden folder show. If I double click on folder it open. What is the solution?

How to unlock Myfolder after forgetting password?
where is all the hidden file are in c drive?

just go to search bar and search for your files........u will get your files

I have been able to search the file that has been searched for by using it.

I want to lock Permanent.

Hi

Sorry to say but it's not working. I'm using win 7 home premium edition. SP1. The bat file locker.bat it's not even executing. What to do?

Thank u.

Hi
I have created this batch file in pen drive

but when i opened it next time it is converted into text file and now i can not read anything written in it and now it became a read only pen drive and now i can't delete or add anything into it. it can't be formated.

please give me some solution for this.

hello,i wanna thank you for this trick,it worked for me,but i got a question.what is the origin of this code,if it is created about a programming language or something else?

.bat The first filename extension used by Microsoft for batch files. This extension runs with DOS and all versions of Windows, under command prompt or cmd.exe, despite the different ways the two command interpreters execute batch files. The bat file is much easier way than having to use command prompt all the time.

what if someone deletes that .bat file????????????

HOW to LOCK and UNLOCK YOUR FILE.

Guys, if you already typed in your password, you can access the folder and therefore, the folder is unlocked. NOW, after you're done with your business with the folder, you should click the ".bat" folder again to lock it once more. YOU'RE WELCOME.

How i forgot my password i have imp on that folder plz help me out

Problems
1) File opens with any word as password.
2) When we search in main search box in my computer , the files come even of the protected file/folder.

[https://pastebin.com/b08z1sKG Hey Guys, I Re-Created This To A Better Advanced Version. If you would like to use it go here: pastebin.com/b08z1sKG

Thanks bro for writing such a creative programming script to solve many of our problems.

However, I still face a problem during test run. When I right click the .bat file, and choose edit, I can see your whole programmng raw data with the password inside ! This way it defeats the purpose of hidding security password from others' viewing.

May I know if others have the same problem ?

May I know if there is a way to 'not allow others view the password by clicking 'edit' the .bat file ?

Many thanks
Regards
Jimmy

YOU CAN EDIT AND ERASE YOUR PASSWORD AND THE WORD ECHO AND THEN SAVE
:UNLOCK

ECHO Enter password to Unlock folder

Unfortunately, the folder will open with any password.

hey guys

i forgot my password and tried several times..... i went to edit by chance and found the password.... now im entering the correct password but is giving me a message : access denied and it just turns off.... please i really need the folders that are saved within

I forgot my password , plz help

The folder lock doesn't work it opens even if a wrong password is entered

Hi,

I locked a folder on an external hard drive. I then reinstalled windows10 PC and no longer able to open my hidden folder inside external harddrive although correct PW was entered. I think formatting the harddisk and new windows is the issue. Please advice how to open my hidden folder. I have important doc in the folder. Thanks

If the preview pane is open, and you single click on the batch file, you can see the entire code, including the password.

I have created a locked folder, and it works. HOWEVER, when I accidentally entered a wrong password, it gave me a message "Fail", but unlocked the folder anyway. I then experimented with random passwords, and they all unlocked the folder.

password not created please unhide my folder.

password not created what can i do to unhide my folder plz solve yar

heyy chetan is your problem fixed or do you still need help?

Hey, I have locked the folder as per the instructions and it worked. Now I have opened the folder after a month, the folder is empty. Please help

Please help, I have locked the folder as per the instructions. Now after a month I have opened it, the folder is empty. Please help

Dear Sir,

I was locked/hidden my folder as you suggested above mentioned code. But, after that due to some another reason, I have to format my PC . After formatted, I could not access files which folder locked by .bat code. Kindly help me in this regards at the earliest. I used Office XP system.

I upgraded to Windows 10 and now when I single click on the batch file it displays the script including password on the right hand side of the folder. Is there a way of preventing this?

Share Your Thoughts

  • Hot
  • Latest