How to create a hidden, password protected folder on Windows without any third-party program [Guide]

Do you use software, or a program, or an application to make your file(s) or folder(s) private (password protected) in Windows? How about making a folder private (password protected) in Windows without using a program, or having programming skill at all? This article shows you have to do that.

In this article we are showing you how to create a simple custom script that makes a hidden folder that can only be opened using a password. This should work on Windows XP and higher (meaning Windows XP, Vista, Windows 7, and Windows 8) although I’ve tested it on Windows XP and Windows 7 only.

To password protect a folder on Windows, first open Notepad and copy & paste the entire script given below. Use your custom password in place of the word marked in red, and save the file as file.bat instead of file.txt (if you don’t want to use ‘file’, any name is okay but it must be a .bat file).

2013-06-13_103554cls

@ECHO OFF

title Folder Locker

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

if NOT EXIST Locker 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 Locker “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 the folder

set/p “pass=>”

if NOT %pass%== password 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

:FAIL

echo Invalid password

goto end

:MDLOCKER

md Locker

echo Locker created successfully

goto End

:End

Now, place the file.bat in a directory which, you think, may not be visited by a person other than you (there is a reason for that, please keep reading). Then, double-click on the file.bat, and you will see that a new folder Locker is generated in the same directory. You drag-n-drop all of your private files and folders in this Locker. Now again, double-click on the file.bat. A black window will open up, and ask, “Are you sure you want to lock the folder(Y/N)“. You type y, and hit Enter. You will immediately notice that the folder Locker vanishes! If you want to bring it back, you again double-click on the file.bat. A black window will open up again, and ask, “Enter password to unlock the folder“. You type your custom password, and hit Enter. The folder Locker will be visible again.

Oh well, there is a little issue in this method. If you want to use this script method in Windows 7, both “Don’t show hidden files, folders, or drives” and “Hide protected operating system files (Recommended)” must be enabled. You can do this by going to Organize > Folder and search options, and then to View tab in Windows Explorer. If you want to use this script method in Windows XP, both “Do not show hidden files and folders” and “Hide protected operating system files (Recommended)” must be enabled. You can do this by going to Tools > Folder options…, and then to View tab in Windows Explorer. Do you see the problem? Yes, you got it, anybody may disable those two options to discover your hidden gems! This is why I said that the file.bat should be placed in a directory which, you could think, might not be visited by a person other than you. Admittedly, this method does not offer protection/privacy of your files/folders from a person who has some standard computer knowledge. Nevertheless, it may work but use with caution.

Enjoy!

Share this post

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

16 comments

  1. Mukhi
    Author/

    [@Warb]
    Thanks for the report. This is why people call vista a mess since many things that work in XP/7 don’t seem to be working in Vista which is strange.

    [@Patrick]
    Thanks for the link. Although I am not a programmer, it may be useful some day, IMO.

  2. David Roper

    [@Warb]

    As we say in the South, Bless your heart.I can’t imagine your putting up with Vista any longer. Please get an upgrade to WIN7 if you can buy one for $50. I bought 3 for $100 in a package from Costco or Sams. If that fails, upgrade to Win 8.1 when it arrives, or even Win 8 and get a FREEWARE “Start menu” maker. They’re trying to “give away” Win8.

    Believe me when I say, your Edsel will drive itself to the Scrap metal yard.

  3. David Roper

    patrick, I am guessing that (and I am an old batch writer from way back) that the /p cuase the BAt to pause waiting for keypress, then whatever kaypress is done gets set as an envir variable. Much like INKEY$ did in Basic for me.

    I am just guessing.

    I am so proud of myself recently having written a batch file for the WIN 7 start up folder that runs my PALM Desktop (freeware) and then OUTLOOK.COM and finally, my GMAIL account if and only if it’s before 11am, OW it goes straight to desktop. I haven’t programmed anything useful in 10 years.

  4. Patrick

    Hi,

    Reminds me a lot of good old DOS .bat processing/scripting (as pointed out by Muhki above, and indeed quite different from Unix… Memories are made of this ;-) But that was in the early days (Win98,…), and I haven’t done any programming or scripting for years… :-(

    1. So what does “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” stand for? While googling I dit find the same hex all over the place but did not find any explanation. Perhaps someone might get me on the road to “scripting anno 2013″? Some online manual, perhaps?…
    2. and what does David mean by “the set/p tip”? From what I read so far I gather that from set/p “cho=>” the cho-part evaluates input (from user only or through “piping” output from some other script?), but what the /p-switch means I’ve no idea yet.
    3. It looks like a lot of variations on the above .bat exist, none of which go beyond XP or Win7 (as far as I can make out), but all of them use the same “phrases” as I mentionned above.
    4. Extending or adapting the script may be an interesting exercise (e.g. applying it to work on file level) – and converting to .exe

    As the article states: “it may work but use with caution”. It’s no replacement for other password protection systems. However, it’s a nice toy to play with when learning to write DOS-based scripts.

    Many thanks for any explanatory remarks (or links to up to date Dos-scripting manuals)!

    Have a nice weekend,
    Patrick.

  5. David Roper

    Thanks Mikhi for the set/p tip, too. I never knew that one when inputting a var from input. Neat trick. I also just learned that cd. will reset the errorlevel to 0. Another neat trick.

  6. Mukhi
    Author/

    [@Fani] Backup is okay in Windows. If you wanna keep the same password in another computer, simply copy and paste both the “Locker” folder and the .bat file in the same directory (you can also use a backup program), and it will work there as well. As far as I remember, .bat does not work in Linux directly; with WINE, it may work; however, the syntax of scripts in linux is different (.bat DOS based); therefore, I am afraid that this script may not work in Linux at all.

  7. Mukhi
    Author/

    [@David Roper]
    Okay for any computer.
    [@naveed]
    TrueCrypt is a great one for real protection but this article aims to help those people who just want some quick temporary protection, it’s not that easy to figure out that a person is using such kind of protection unless you really “target” it.

  8. naveed

    Security by Obscurity is bad in general, but this is really bad – fine if you want to hide something from your computer illiterate roommate maybe, but not for anything else.

    Use TrueCrypt or AxCrypt if you really need encryption.