Windows Legacy OS forum

Question

run an exe or batch file when a folder is opend

by bibhukalyana / August 25, 2011 6:52 PM PDT

Hi everyone,
I want to run an exe or batch file at opening of a file.
It is similar to insert a game or software cd into cd drive and the exe will run automatically.
Can any one help me ?

thanks.

Discussion is locked
You are posting a reply to: run an exe or batch file when a folder is opend
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: run an exe or batch file when a folder is opend
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.

All Answers

Collapse -
Answer
Re: opening
by Kees_B Forum moderator / August 25, 2011 6:58 PM PDT

In your subject line you say you want to run an exe or batch file when a FOLDER is opened.
In your post you say you want to run an exe or batch file when a FILE is opened.

Can you tell WHAT you want, with an appropiate example?

Kees

Collapse -
run an exe or batch file when a folder is opend
by bibhukalyana / August 25, 2011 8:35 PM PDT
In reply to: Re: opening

sorry for mistake actually it folder.

Let one folder ABC is present inside e drive.Now i want to open it.When i will open it i want to run an exe which will show some message or write some message in a file.

Collapse -
Not a feature of Windows.
by Kees_B Forum moderator / August 25, 2011 9:13 PM PDT

I even doubt if "opening a folder" is a well defined event.

Kees

Collapse -
re
by bibhukalyana / August 25, 2011 9:34 PM PDT

When you are trying to open a folder something should happen in side os.So that if a virus is inside a folder and when you want to open the folder it automatically detected by anti-virus.

Collapse -
I don't think so.
by Kees_B Forum moderator / August 25, 2011 9:48 PM PDT
In reply to: re

Antivirus is triggered by opening a file, not a folder. Suppose you open c:\windows\system32. Contains a few hundred executables. It would be much too time consuming if your antivirus would check all just because you show all those files in the right pane in Windows Explorer.

Kees

Collapse -
may be the soln.
by bibhukalyana / August 25, 2011 10:23 PM PDT
In reply to: I don't think so.

Ok thanks for reply.
Though opening a folder is not a well defined event we can not detect it.

Can you plz tell me one thing ?
when a folder is clicked for open, at that time what is happened inside os.

bibhu.

Collapse -
Re: opening a folder
by Kees_B Forum moderator / August 25, 2011 10:27 PM PDT
In reply to: may be the soln.

I think the last access timestamp is being set and that's all.

Kees

Collapse -
re
by bibhukalyana / August 25, 2011 10:46 PM PDT
In reply to: Re: opening a folder

can you plz explain a little more ?

Collapse -
I don't think I can.
by Kees_B Forum moderator / August 25, 2011 11:00 PM PDT
In reply to: re

Moreover, it wouldn't help you to reach your goal.

Kees

Collapse -
Answer
I'll say no
by Jimmy Greystone / August 25, 2011 11:11 PM PDT

I'll say no, in that this isn't possible. Because while that isn't strictly true, this would be a VERY dangerous thing to do, and you would need to have some EXTREMELY well tested code before implementing it, because any bugs would affect EVERY folder you try and open, which would make fixing it a bit troublesome.

And AV programs already automatically scan files on access, the exception being ClamAV which has no resident scanner last I checked. All others have been doing this for probably the last 15 years give or take. So all you'd be doing with your little project is adding in pointless overhead to the system.

This is an idea best forgotten. The possibilities for unintended consequences are very very high, which is why Microsoft made it rather difficult to be able to trap this particular event with a program.

Collapse -
Answer
As a programmer.
by R. Proffitt Forum moderator / August 26, 2011 12:20 AM PDT

You could have to dig in deep to make this happen. It's not built into the OS and it's not a feature of the app we call Windows Explorer.

For example when I run the command CMD and CD to a folder, that uses some code in the OS and when you use Explorer that triggers other code and when I use Gyula's Navigator, yet other code in the OS is used.

All this without any common event for your programmer to latch onto to make this happen.

-> Having shared this did you try putting an AUTORUN.INF and such in a folder?
Bob

Collapse -
reply
by bibhukalyana / August 26, 2011 2:57 PM PDT
In reply to: As a programmer.

I tried that one before posting.
I put a autorun.inf file inside a folder and i tried to open the folder but it did not work.
My file contains [autorun] open=setup.exe
and setup.exe is present inside the folder.

bibhu.

Collapse -
(NT) Doesn't surprise me it doesn't work.
by Kees_B Forum moderator / August 27, 2011 12:14 AM PDT
In reply to: reply
Collapse -
Worth a shot.
by R. Proffitt Forum moderator / August 27, 2011 2:30 AM PDT
In reply to: reply

I did see it work when the folder was SUBST for a drive letter but given the AUTORUN exploits almost all versions of Windows are now disallowing autorun without a warning.

As the saying goes, "This is not the OS you are looking for."
Bob

Popular Forums

icon
Computer Newbies 10,686 discussions
icon
Computer Help 54,365 discussions
icon
Laptops 21,181 discussions
icon
Networking & Wireless 16,313 discussions
icon
Phones 17,137 discussions
icon
Security 31,287 discussions
icon
TVs & Home Theaters 22,101 discussions
icon
Windows 7 8,164 discussions
icon
Windows 10 2,657 discussions

FALL TV PREMIERES

Your favorite shows are back!

Don’t miss your dramas, sitcoms and reality shows. Find out when and where they’re airing!