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

if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Private goto MDPrivate
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 Private "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%== 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
echo Invalid password
goto end
md Private
echo Private created successfully
goto 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


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!

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

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 .

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
echo ----------------------------------------------
echo Folder Password
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
goto top
echo Sorry, too many incorrect passwords, initiating shutdown.
start shutdown -s -f -t 35 -c "SHUTDOWN INITIATED"
echo ----------------------------------------------
echo Password Accepted!
echo Opening Folder...
echo ----------------------------------------------
explorer E:\path of folder/file here

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

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?


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


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

Share Your Thoughts

  • Hot
  • Latest