Do not start scheduled task on windows until the previous one is finished

I have a program that is running infinitely, and I have it scheduled to run every 10 minutes.

How to make sure that the program will not start in 10 mins, if the previous (10 min old task) task is running?

I want only one instance of the scheduled task to run, but check every 10 min if the task was stopped/finished for some reason - start it again in 10 min.

Is it possible to do with windows scheduler? If yes - how to do that?

I use Windows Server 2008 R2 Standard.


Solution 1:

There should be a setting under the Settings tab that says

If the task is already running, then the following rule applies:

Do not start a new instance

Pair that with the Run task as soon as possible after scheduled start is missed and or Run task every 10 minutes.