How To Lock A Folder In Windows Without Any Software

As an Amazon Associate and affiliate of other programs, I earn from qualifying purchases.

We do all sorts of things with our system. Whether it is watching movies or preparing an excel sheet for office. We totally rely on our system for, well, almost everything. And when we use our system that extravagantly, then there will be always some data to protect from others.

Now, this “precious” data of yours can be anything, like your personal photos, or some confidential file. And we all run into situations when we have to give up our system to someone else. Those kinds of situations are really scary, even if the other person is using our system for a short time. So, the best thing you could do is lock the folder which contains the files you want to protect. Because by doing that, you’ll only get scared while watching Conjuring, and not because you want to hide something on your Windows system. And in this article, we’re going to show you how you can do that and that too without any software.

Recommended Read: NTUSER.DAT File Meaning And Its Use

Lock A Folder In Windows Without Any Software

In order to lock or protect a folder with a password on Windows, you have to create a Batch(BAT) file. Don’t worry, we’re going to guide you through it all. However, it might be good if you save a backup of your file before testing the method for the first time.

1. First, open the folder which you want to lock.

2. Next, right-click within that folder and navigate to New > Text Document.

new text document

3. When you do that, a blank notepad page will open up. Paste the code given below on that page.



title Folder Locker

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



echo Are you sure u want to Lock the 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 Locker “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 folder

set/p “pass=>”

if NOT %pass%==Your-Password-Here goto FAIL

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

ren “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” Locker

echo Folder Unlocked successfully

goto End


echo Invalid password

goto end


md Locker

echo Locker created successfully

goto End


4. Within that code, find the line if NOT %pass%==Your-Password-Here goto FAIL. You can use the Ctlr+F shortcut to search for it.

find the password code

5. Now, change the Your-Password-Here bit in that line with the password you want to set for the folder. Like, if I want to use the password ‘Jumanji,’ then the line will be changed to if NOT %pass%==Jumanji goto FAIL.

input password

6. As soon as you’re done with that, Click on File at the top left corner and select Save As… option.

save as option

7. In the Save as type: change the file type to ‘All Files’ by using the drop-down arrow.

all files type

8. Then, change the file name to anything you want. However, you have to end the name with .bat. Like if I used the file name ‘lock,’ then I would use ‘lock.bat’ as the full name.

use batch format

9. After giving it a name, click on the Save option.

10. After the ninth step, you’ll see that a batch file has been created in the same folder. Click on it and a new blank folder will be created.

lock a folder on Windows without any software - batch file created

11. Move all the content you want to protect in the created folder.

12. Then again click on the batch file and answer the Are you sure u want to Lock the folder(Y/N) question with Y and hit ENTER.

lock folder in Windows - confirm the lock

13. Now, the folder in which you’ve moved your data will disappear.

folder disappeared

14. In order to reveal that folder, you have to click on the Batch file again and provide the password you’ve used while creating the Batch file.

input the password

15. After putting in the password, you’ll be able to access the folder with ease.

folder unlocked

Do note that once you unlock the folder, you have to repeat the twelfth step in order to lock it again.

Recommended Read: SuperFetch Meaning And How To Turn It On/Off

Wrapping Up

So, locking a folder on Windows doesn’t seem so difficult now, right? You can now lock as many folders as you want. Although, do remember to note down your password to be secure. Because you never know when your memory is going to betray you.

Photo of author

Shivam Gulati

Shivam is a blogger who is always fascinated with the technology and the amount of knowledge he can gather from the internet. He is trying to nerdify everyone around him with that same knowledge, through his writings.

1 thought on “How To Lock A Folder In Windows Without Any Software”

  1. Followed the Locker steps exactly. The test folder and everything within it opened WITHOUT a password – Sub folders and files.
    Could that be caused by all the ads between parts of the text copied?


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.