SEARCH

How-To Geek

How to Create a Password Protected Folder without any Extra Software

image
There are a lot of methods that you can use to create a password protected folder, most of which require the use of some third party software. Using this neat method you can hide your folders with a quick batch script.

It’s important to note that this will not actually conceal your data from somebody who knows what they are doing.

Note: if you are a beginner you should be careful with this script.

Create Your Password Protected Folder

Before you get started you need to create a folder that will house your password protected folder, this is just an ordinary folder and can be located anywhere and named anything.

image

Navigate into your newly created folder and create a new Text Document. This can easily be done from the context menu.

image

Open the document, now paste the following code into the contents of the document:

cls 
@ECHO OFF 
title Folder Private 
if EXIST "HTG Locker" goto UNLOCK 
if NOT EXIST Private goto MDLOCKER 
:CONFIRM 
echo Are you sure you 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 Private "HTG Locker" 
attrib +h +s "HTG Locker" 
echo Folder locked 
goto End 
:UNLOCK 
echo Enter password to unlock folder 
set/p "pass=>" 
if NOT %pass%== PASSWORD_GOES_HERE goto FAIL 
attrib -h -s "HTG Locker" 
ren "HTG Locker" Private 
echo Folder Unlocked successfully 
goto End 
:FAIL 
echo Invalid password 
goto end 
:MDLOCKER 
md Private 
echo Private created successfully 
goto End 
:End

Change the PASSWORD_GOES_HERE text to the password you want to set. Now go ahead and save the file as locker.bat.

image

Once the file is saved as a batch file you can delete the original text file.

image

Now run your batch file by double clicking on it–the first time you run it, it will create a folder called Private. This is where you can store all your secret things. When you have finished adding all your stuff to the Private folder, run locker.bat again.

image

This time you will be asked if you sure that you want to lock the folder, press the “Y” key and hit enter to lock your folder.

image

You will see that your Private folder quickly disappears.

image

If you run the script yet again, you will prompted for a password.

image

If you enter the same password as you set in the script the Private folder will reappear if you enter the incorrect password the script will just Terminate.

How to See the Files Again

Most people don’t know how to show system files, but anybody who has some experience will probably be able to quickly figure it out in the Folder Options. To see the files again, all you have to do is uncheck the boxes for “Show hidden files, folders, and drives” and uncheck the box for “Hide protected operating system files”.

But any ordinary user who unchecks the box will most probably be scared off by the warning message that appears.

The second way someone could comprise the folder is to open the batch file and read your password. It’s definitely not a really secure way to hide your files, but it is fun.

Attribution note: We found this script on dozens of different web sites going back many years. We have no idea who first created the script, so we’ve omitted any sort of attribution link. If you do have proof that you first created the script, contact us and we’ll adjust the article accordingly.

If You Forget Your Password

Seems like once a week somebody writes in asking how to figure out the password they set. And the answer is really simple: Right-click on the locker.bat file and choose Edit.

Then you can see the password you set in the file.

Taylor Gibb is a Microsoft MVP and all round geek, he loves everything from Windows 8 to Windows Server 2012 and even C# and PowerShell. You can also follow him on Google+

  • Published 08/31/14
  • Edward Gudz

    First : If the folder is not visible and the batch file is not named anything blatant to give it away then you really have nothing to worry about, if not then you should not be hiding folders.

    Second: Convert the batch file to .exe, most do not know how to decompile an .exe file, this will give you an extra level of security.

  • Alejandro Roger Ull

    Not again please, this is confusing for newbies and actually innacurate, as you are not protecting a thing. The last time you did this BAT thing to pseudo-password protect a folder a bunch of people complained in the forums that they could not unlock the folder and lost access to their data because of misuse.

    I totally recommend against this method. You should better explain just how to make and unmake a file a hidden and/or system file both through GUI and CLI and leave the BAT thing.

  • StarsLikeDust

    Echoing Edward_Gudz its important to note that your password will be easily accessible by anyone who opens the .bat file.

  • Andrey

    Do not encourage people to use this tip, is insecure. Instead, encourage the use VHD and BitLocker.

  • CogniView

    I think that, in an environment where you don't have to worry too much about other users having the knowledge to easily overthrow your efforts, this is a good little hack. Obviously it's not meant for keeping extremely sensitive data safe, but for a quick trick to keep prying eyes out of your business, it's not a bad option.

  • Charles Jones

    Perhaps Secret Disk (free and $14.95 Pro) is a better option. There are two levels of password protection and the folders and contents are hidden.

  • Erik Hicks

    OMG - seriously??This is the kind of 'tip' I'd see in an article way back in the days of Windows 3.1! There's much better ways of 'hiding' a folder. How about setting the NTFS permissions to only allow your account to access it and its contents? How about using an encrypted storage container using TrueCrypt or BitLocker? And yeah, simply editing the "locker.bat" file would reveal the password.

    I'm floored, HTG. LOL! Seriously... I gotta laugh and be dismayed at the same time. April 1st is long gone, guys.

  • Lowell Heddings

    Right at the beginning of the article we mentioned that this trick won't stop anybody that knows what they are doing.

    And then at the end of the article we showed how to display the hidden files, and even how to get your password back should you forget it.

    It's meant to be a fun trick, not a place to store your bank account details. Most people will probably use it to hide stuff from their more clueless relatives.

  • cha

    There are additional steps you can take to make this more secure - at least in the social engineering sense.

    Say you want to hide a bunch of files. Here's what you can do to add as many hoops as you can for people to jump through.

    Put them on a USB drive, so that you can physically hide it someplace.

    Copy a bunch of random system files from your computer. This is to add a bunch of noise for snoopers to have to sift through. So now your top level of the USB drive should have tens if not hundreds of random folders and files.

    add an innocently named folder to this directory. Say "cgi-bin" or something that blends in..

    inside this new folder repeat step 2.

    Add more folders that seem innocent enough, add more junk files. small text files that don't take up much space.

    Once you've sufficiently buried your "secret" folder. Place this locker.bat file here, rename the folder from "private" to something less conspicuous, like "dir" for example - again, something that will blend in to the surrounding folders and file names.

    Run this script to password protect and hide this secrets folder.

    Then when that's done. rename locker.bat to something random, like "00xb011.obj" something no one would bother to open - and even if they did, since you altered the file extension they would need to know to change it to a .bat file.

    9.Inside of your secret folder, take all of the files that you want to hide, lets say they're image files. change the extension from .jpg to something stupid and random like .mox...

    So now if someone wants to find your stuff, they'll have to either be really patient and determined, or string together several lucky guesses. Even if they found your files, unless they know what they're doing they will yet again have to guess the correct file extensions. If you surround each step of the way with tons of random junk it will only serve to convolute the process.

    then, whenever you want to access the files, you of course know the path to get to the folder. just rename that "00xb011.obj" back to locker.bat, use it, access the files, and then rename them back to .jpgs.

    profit.

Enter Your Email Here to Get Access for Free:

Go check your email!