Time limit on executable
Posted: 19 Jul 2012 09:09
I am looking to incorporate a time limit function on an executable that I am running multiple times from a batch file.
I know that I can use the "ping localhost" command to delay for a set amount of time and then "taskkill" to terminate my executable if it is still running after the delay.
However, my problem is this: Some times the executable may take only a few minutes, sometimes it will take a few hours (with 24hrs being the cut-off I wish to set). If I set the batch file to delay 24hrs before trying to kill the executable and the executable finishes after only a few minutes, the next run of the executable will not start until 24hrs have passed. I want the next run to start immediately after the previous one finishes.
As an additional note, changing the source code of the executable is not really an option for me, as it is developed by a third party and they would most likely decline to incorporate my changes.
Thanks!
I know that I can use the "ping localhost" command to delay for a set amount of time and then "taskkill" to terminate my executable if it is still running after the delay.
However, my problem is this: Some times the executable may take only a few minutes, sometimes it will take a few hours (with 24hrs being the cut-off I wish to set). If I set the batch file to delay 24hrs before trying to kill the executable and the executable finishes after only a few minutes, the next run of the executable will not start until 24hrs have passed. I want the next run to start immediately after the previous one finishes.
As an additional note, changing the source code of the executable is not really an option for me, as it is developed by a third party and they would most likely decline to incorporate my changes.
Thanks!