Search code examples
windowsscheduled-taskswindows-server-2012

Stop a Windows Task Scheduler task after a certain time


Is it possible to make a scheduled task stop after a set number of seconds?

What I want:

  1. Run task every 5 minutes
  2. Stop task after 30 seconds

So I can run a file then after the given time stop the task.

Thanks for your help!


Solution

  • You would need to schedule another task to kill whatever program you are running, something like Taskkill. Here is the link to the Microsoft site on how to use TaskKill http://technet.microsoft.com/en-us/library/bb491009.aspx.

    I would question why you need to kill a program though, you should look for a method of having the program terminate itself when it needs to.