How to Protect A Folder Or File With Password in Windows 10 [Without Software]

Once you’re on a computer or a device that uses the internet, our security becomes one of the most major concerns that we’ll have to deal with. Although you can lock your computer with your fingerprint or passwords you can’t lock your folders or files without using any special software or tools. This means when you share your computer with your friends or families, they can easily access your all folders and their content. After this tutorial, you’ll be able to lock and protect your computer’s folders or files with a simple trick without using any tools. So without further ado, let’s know how to do this.

Related: How to Enable Dark Mode in Windows 11

How To Password Protect Folder Or Files

There are plenty of tools available on the internet. Using that, we can easily protect our documents. But in today’s article, you will learn to protect files without using any external software. You can do it just by using only the notepad! So let’s begin.

1: First of all open Notepad on your computer and copy the code given below and paste it to your notepad.

@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%== Type Your Passwordgoto 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

2: Now Just scroll down a little bit and you will see a line “Type Your Password” (I’ve highlighted in the above code). Just remove that line and type your desired password (in my case password is “Nitesh”). Click on save and give it any name with .bat extension (for Example- Lock.bat).

How to Protect Folders on Windows 10

3: Boom! you are all set, to lock your files or folder simply open that bat file. After that, you will see a folder named “Private”.

How to Protect Folders on Windows 10

4: Put all the documents or files in the private folder that you want to protect. After that again click on the bat file, and a window will pop up for confirmation. Just type “y” (Y=’Yes’ | N=’No’) and hit enter. And the private folder will be disappeared. That means you have successfully protected your files or folder without using any software.

CMD Prompt

5: To bring it back similarly again click on the bat file and it will ask you to enter the password. Just type the password and hit enter. And your confidential files or folder will be visible.

CMD Prompt2

Bottom Line

So, guys! that was the simple trick to protect your folders without using any software. I hope you understood all the steps clearly. If you have any doubt then let me know in the comment section we’ll definitely help you.

Related:

Leave a comment