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 ?

  • 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 Nov 21 '14 at 12:43
  • It might be easier to just monitor tasks and immediately kill the ones you want to block – Suchipi Nov 21 '14 at 18:21
  • How do I trigger the task when an exe file is opened ? Which event should I listen to ? – JBE Nov 22 '14 at 7:48
  • For those interested about how to trigger task when an exe file is opened : superuser.com/questions/843645/… – JBE Nov 23 '14 at 1:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.