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.

Cover image and screenshots via WonderHowTo

40 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.

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

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........

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

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

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???

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????????????

Share Your Thoughts

  • Hot
  • Latest