Hello all,

I was trying to make a folder secure. So when the folder is opened( or any operation is performed on the folder like deletion) an application would open and ask for password. The application i have is an exe file which is dos based and asks for password. Is there any way to make this sort of connection between the file and the folder ? or should i write some batch files like autoexec.bat ?

Thanks all in advance!

Any help would be greatly appreciated.


Recommended Answers

All 12 Replies

Windows doesn't natively support this. If you want to password protect something on the file system, unforunately you will have to encrypt it. There's some software out there already that do this exact function.

There may be a way to do this with a programming language such as C++, but it is definately beyond writing anything in batch. You would need to either modify windows system files, or attach to explorer.exe and halt the accessing/tampering of certain things in the file system.

Make an exe file that contains a code which can ask user for password and handle it accordingly. Make a new file with extension ".inf" in which you will include the below lines:
open=filename.exe /argument1

Now whenever you will call/open your folder containing these files, the .inf file will automatically be called and thus your exe file will be executed.

However, the only problem here is most probably your antivirus can remove this .inf file considering it as some kind of virus.

YOu can use truecrypt or other softwares to password encrypt your files or folders.

Thaks for your replies:)
Where do i put the inf file ?
Yes jingda, But i want to try this way and moreover the softwares i downloaded are all trialwares.

How can i halt access to certain folders ? Is it related to putting some restrictions on certain directories.

Put that inf file inside the folder that you are talking about.

@secrum :
I did that but when i opened the folder no exe file executed

Then try to edit the file and insert an additional line in it.


Note: Windows will start the file while opening the folder and not instead, so your files won't be protected. On top of this, anybody can open that folder with a 3rd party program or with disabled autorun, so it's not real security.

Have to agree with you MoZ01, but is always better than nothing.

You can always use 7zip (free) or anything else to encrypt stuff instead.

TrueCrypt which is suggested earlier, is also free. - NO trial ware, and NO nag screens and such, but fully functional.

Using truecrypt, you can create a highly encrypted file, and mount it as a drive with a folder structure.

Another option could be to create a new small partition on your harddrive, and encrypt it with bitlocker. But that is even more trouble than using truecrypt imo., and still isn't what you ask for (which isn't functionally sane btw. ;) ), so I recommend TC as the best safe alternative as I see it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.