Protect a folder with a password without software

protect a folder by password without software
protect a folder by password without software

Last updated: September 4, 2023

To prevent a family member or friend from accessing your data, you can protect your sensitive files with a password.

On the web, there are dozens of programs for securing access to files with a password, but which are very often complex to use and take time to configure them.
In this article, I will show you two methods that I use often, and which may be of use to some. By the end of this article, you will be able to protect a file without any software.

Protect a Windows folder with a Batch script

Step 1:

The first step is to create a .bat file. To do this, open the program " Notepad »(Notepad) is insert this piece of text and save it as locker.bat.

title Folder Private
if EXIST "Control Panel." {21EC2020-3AEA-1069-A2DD-08002B30309D} "goto UNLOCK
if NOT EXIST Private goto MDLOCKER
echo Do you want 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 your password to open this folder
set / p "pass =>"
if NOT% pass% == funinformatique goto FAIL
assign -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 folder created successfully
goto End
: End

You can replace the password which is by default in the code " FunInformatique »With the password you want to put in the file.

Step 2:

Now click on your new locker.bat file. A folder named "private" will be created automatically. Place all your files to hide there.

Step 3:

Click locker.bat again. A black Windows console will open and ask you if you want to hide your folder. Write Y if yes, or N if not. Press ENTER.


Finally your file will be gone. Click on the locker.bat file if you want to unlock it. A black Windows console will open and ask for the password. Enter your password and press ENTER.

Protect a Windows folder without any software

There is another solution that allows you to protect a file and that works well on Windows XP, 7 or Windows 10.

To do this, follow the steps above:

Step 1:

Start by creating a folder named "Private"eg. Then open notepad and iInclude this piece of text:

ren Private Private.{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}

Step 2:

Save the file created with Notepad under the name locker. Beat for example . Copy to your folder Private all the files you want to hide, and double click on the file locker. Beat to activate protection. You will get this:


Step 3:

To unlock it: right click the file Beat, then " Edit ". Replace the previous text with:

ren Private.{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0} Private

Save, and double click on the file asked.

EL JAOUARI is an author and trainer. Passionate about IT security and new technologies. His tutorials have helped many people to better master today's computer tools.