20

If I schedule a task using windows task scheduler for, say, 2 minutes from now, and for some reason the computer is shut down 1 minute from now, and turned on 3 minutes from now, will the task that was scheduled still run?

If not, what can I do to mimic this functionality?

I'm writing a Java application that needs to execute a variety of system commands and I'd prefer the operating system actually manage the task execution phase. All I really need to have happen is for the task to execute as soon as possible by the operating system.

3 Answers 3

24

No, it won't execute. The Task Scheduler in Vista (or higher) can be configured to run missed instances, but XP's cannot. See the checkbox below called Run task as soon as possible after a scheduled start is missed.

However, all three can be set to wake the computer if it's asleep or hibernating.

enter image description here

4
  • 1
    +1 You beat me to it, but I am going to add a screenshot.
    – KCotreau
    Jul 20, 2011 at 0:19
  • 1
    I'm using schtasks to set up the task (programmatically), do you know the flag for "Run task as soon as possible"? Jul 20, 2011 at 0:21
  • 10
    Just got here from a search on "windows 7 task scheduler missed task". Figured I should add a tidbit I found out in my search: the "Run task as soon as possible after scheduled start is missed" doesn't run the missed task immediately. There's a 10-minute delay. So if it was scheduled at midnight and the PC was off, it won't run until 10 minutes after you turn it back on. (Zombie comment, but might be useful.)
    – RobertB
    Apr 6, 2014 at 23:31
  • 1
    @RobertB, I just got here from the same search and your comment was very useful, thanks! Oct 24, 2014 at 17:32
3

Im on Windows 10. Under the properties for the task...click the Conditions tab.

Under Power...check Wake the Computer to run this task.

enter image description here

1

As it was said, you can't do this in XP but can in Vista+. Some programs (like Acronis True Image) use their own schedulers to overcome the system one's limitations.

To emulate this in XP, you can write a program (googling didn't readily reveal any publicly available existing ones) scheduled to run at system startup that would

  • check the system log for the last shutdown and startup times (or rather, Scheduler service's shutdown and startup times)
  • check task schedules against that
  • run the ones who have a start moment that falls into the interval

Caveats:

  • unless you can somehow call the corresponding Scheduler's functionality, you'll have to parse the schedules manually to calculate the next planned start time from a specific moment in the past
  • there's no "run as soon as possible" flag for tasks in XP, you'll have to invent a replacement (or grab everything indiscriminately)
  • since your task runs at system startup, some tasks may fail if they require facilities that have not been initialized yet

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .