Create a password protected folder without any special software


In an earlier post I had written about how to create an invisible folder. That’s a method to create a merely invisible folder with no real protection.

Now, here we will see how to create a folder that will not just be invisible, but also require a password to reveal it and open it. The best part is that you don’t need any special software to do this. Just plain old Notepad is all that you need.

Note: This is NOT a very secure method of protecting your folders. So use it at your own risk.

Here is the code that you need:

cls
@ECHO OFF
title Folder Personal
if EXIST “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” goto UNLOCK
if NOT EXIST Personal goto MDLOCKER
:CONFIRM
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.
goto CONFIRM
:LOCK
ren Personal “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 folder
set/p “pass=>”
if NOT %pass%==pwd123 HERE goto FAIL
attrib -h -s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
ren “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” Personal
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Personal
echo Personal created successfully
goto End
:End

Now here is what you need to do:

Just copy the above code and paste it into Notepad. Save it by giving it any name you choose. Assuming, the file is called secret.txt, change the extension to ‘.bat‘ so that the new name becomes secret.bat. What you get is a batch file. You could actually save one step by saving the file in Notepad directly as secret.bat by enclosing the file name like this: “secret.bat” . This batch file is the one that you need. You can edit this batch file to change the folder name and the password. To change the name of the folder that is created, change the ‘Personal’ (in bold in the above code) to any another name you choose. Likewise change the ‘pwd123′ (in red in the code) to anything else.

Now let’s see how to use it. Place the file in the location where you would like to create your protected folder. Run the batch file by double clicking on it. This will create a folder named Personal in the same location as the batch file. You can now open this folder and place any files in it. Once you are finished, run the batch file again. You will be asked whether you want to lock the folder. Entry ‘Y’ (for Yes) and hit Enter. The folder becomes invisible. To retrieve the folder, run the batch file again. You will be prompted to enter the password. Enter the password, hit enter and voila! the folder appears.

Important: The batch file acts like a key to open the locked folder. So once you have created and locked a folder, do not keep the batch file in the same location since anybody can open the batch file and view your password. So I would suggest that you keep the batch file in a separate and safe place or better still keep it on your pen drive or flash drive. That way when you want to open the folder just copy the batch file to the location where you have your protected folder and run it.

Do remember that the above method is not intended to act as a substitute for the numerous free and commercial softwares that are specifically designed to provide security and encryption to your data.

Update: I got comments saying the code does not work. Of course I did check it before posting it here. But I have identified the problem. The problem is with the straight double quotes used in the code in this post. Once you copy the code you would also need to change each of the double quotes with your keyboard double quotes. That might seem a lot of work for some. So I thought it would be easier to give away the batch file itself. You can download the file here. (Use right-click and ‘Save Target as’ or ‘Save Link as’).

Related Posts Plugin for WordPress, Blogger...
Freelance Jobs

  • Pingback: Create a password protected folder without any special software

  • Mitameet

    Thanx a lot it really good
    kindly share some more like this
    on my ID
    mitameet@gmail.com

  • Mrittik

    Understood thanks!

  • Mrittik

    how to assign the password
    after i hit y in the batch file it becomes invisible
    after that when i again run the batch file i am prompted to enter the password while i have not yet assigned the password
    hoe to assign it
    Help Me

  • John-doe

    thanks! this is brilliant, was trying to fix the first problem for ages, then once i realised it was to do with the quotes and fixed it I came back on here to see the next part, and then i saw the update telling me so! :) another update worth adding in is that passwords that have spaces in them do not work.

  • Dike969

    if yout type a wrong password it will still open it

  • al quitoi

    I used this method and I have a key that makes the file in visible by using a password. However the files are visible when you search files. What is wrong.?

  • Bchinmay4u

    Thanks a lot. It is really nice

  • JP

    This is just what I’ve been looking for – almost.
    I need to make it uneditable so the password can’t be seen – I’ve tried the EXE file but get an error message saying the CPU has encounted an illegal instruction and closes.

    Any advice

  • http://www.drbatcher.com Roger

    Thanks for your post! It helped me much when I wanted to create the protected folder on about 100 PCs in our office. I just want to tell you that it is handier to convert this BAT file to EXE, I did it with help of Dr.Batcher ( http://www.drbatchet.com ). Also this tool is useful to create batch files in general.

    • Dike969

      i guess there is something wrong, u can enter any password on it

  • Deep

    folder is not invisible……plz help me how it will be invisible……….

  • Rexzu

    You dont have to copy the bat file to another location if you convert the bat file into exe file. Than noone can see your password, but only minus is that you cant change your pass and/or folder name anymore.

    • Chauhandpk

      but wot if i will delete the .bat or .exe file…. how can i get the invisible folder… its

  • roth

    it really works well. thank you very much!!!

  • harral

    I figure out the problem in the code which allow any password to appear the folder………………
    just del the HERE in front of pwd123 (inred colour).
    enjoyeeeeee….

  • TNT2898

    I set this up yesterday with all the fixes and was able to use it with no problem. Today when we opened it and altered the files inside now we cannot lock and hide the folder. When it shows the locking screen and we put “y” in to lock it it gives the response “access denied”. Please if anyone knows how to fix this it would be a great help.

  • “R”Ego

    WoW o.O … you’r the best. Thanx for the code.

  • Narayanan

    Hi sumit,

    This is really a good one only in the above code Remove the HERE after your password then it will work

  • suraj

    its great man
    thanks a lot

  • Hameed

    If the .bat file deleted how can get back the data’s???

    where our files are storing???????