Automatically run executable files with third party program/script in Windows

1

1

It is possible to launch an exe file using a third party program through the context menu.

My problem is that an exe file might be triggered by a script or by another application on which I don't have control.

How can I force every executable files to run using a third party program/script ?

Comodo Programs Manager has a running service that automatically monitor any installation of exe file. How do they proceed ? Is it possible to listen to specific events ?

I thought I could use a BATCH script by :

  • replacing the default registry key of HKEY_CLASSES_ROOT\exefile\shell\open\command by something like path\to\my\script.bat "%1 %*"

  • in the script, do custom stuff like logging and then call the executable :

    ...
    
    echo %DATE% %TIME% %* >> "somewhere\logging.txt"
    
    ...
    
    :2
    @REM Monitor file (same as context menu open with ...)
    path/to/monitoring.exe %*
    goto end
    
    ...
    

This would work for a PDF file for example. But it obviously doesn't work for executables because path/to/monitoring.exe %*, when executed, is running the script again ... and I can't find a way to launch an executable without going through the registry file association.

Is it something possible ?

JBE

Posted 2014-11-21T04:54:43.953

Reputation: 224

Have you tried using Windows OS in-built "Task Scheduler" to run an exe on an event?. From Start menu > type "Task Scheduler" > Create Task > name the task > Triggers tab > choose when it has to trigger from "Begin the Task" list box > choose the time frame > Ok > Now, Action tab > New > Start a Program > provide the path. Check this and the results. – vembutech – 2014-11-21T12:43:43.017

It might be easier to just monitor tasks and immediately kill the ones you want to block – Suchipi – 2014-11-21T18:21:51.287

How do I trigger the task when an exe file is opened ? Which event should I listen to ? – JBE – 2014-11-22T07:48:41.663

For those interested about how to trigger task when an exe file is opened : http://superuser.com/questions/843645/how-to-trigger-a-task-each-time-an-executable-file-is-open-with-windows-task-sch/843767#843767

– JBE – 2014-11-23T01:02:25.210

No answers