Example: I have a task that is scheduled for 6 am every day (only if I'm logged on). If my computer sleeps/hibernates all night until 9am, upon waking up the task will then run even though it missed its 6am schedule. I don't want that to happen as it's important that the task runs only at 6am.

I thought that unchecking the "Run task as soon as possible after a scheduled start is missed" setting would prevent this, but it doesn't. Is there another setting I should try so that the task will run only if the computer is on at the scheduled time (and will wait until the next scheduled time if it misses it)?

An example of my settings:

enter image description here

  • 1
    i see that you have enabled that the task should be run every 5min if it fails. As far as i know a task which time has passed and it hadn't been run is treated like a failed task. So it may be due to that Checkmark. – konqui Jul 11 '14 at 10:51
  • I'll try that out, thanks for the recommendation @konqui. – zants Jul 11 '14 at 21:36
  • 1
    Nope, that didn't do it either :( There's the normal wait as the computer comes out of sleep, and then a few seconds later all of my tasks fire off at once. – zants Jul 12 '14 at 20:16

I found a workaround: make your task launching your .bat script, which will launch the command if it discovers computer wasn't asleep. Script I use is:

@echo off
for /f "delims=" %%t in ('time /t') do if "%%t"=="%1" %~2

This script takes two parameters: first is time when the command is intended to be called, and the second is command itself, in quotes, like script.bat 21:40 "echo x".


Unlike in Bash, in Batch it's impossible to directly store command output in variable, but one can iterate over it's output line after line. That's what my second line does. Because time /t's output
is single line, there is only one iteration, in which the script launches the command (passed as second parameter) if script was called when you wanted it to be called; this condition will not be meet when this is delayed execution of the script.

I use %~2 instead of %2, because %~2 discards quotes around command,
so that passing "echo x" will execute echo with argument x, printing x,
instead of invoking program echo x with no arguments.


  1. Launching task on demand will do nothing, you'd better uncheck field Allow task to be run on demand in the Settings tab, not to be confused by that,

  2. Modifying task's execution hour requires modifying the arguments to keep the task working,

  3. time /t's output depends on the regional settings.
| improve this answer | |

To run a scheduled task when the computer is idle, raise "Wait for Idle for:" and maybe checkmark "stop if the computer ceases to be idle".

  1. Right-click the task that you want to run when the computer is idle, and then click Properties.
  2. On the Conditions tab, under Idle Time, select the Only start the task if the computer has been idle for at least check box.
  3. Enter the length of time (in minutes) for which the computer must be idle before the task will run.

NOTE: You can also specify that any task should be stopped if the computer is in use by selecting the Stop the task if the computer ceases to be idle check box.

To understand Idle Time follow this link...

| improve this answer | |
  • 3
    This answer appears to have nothing to do with the question! – kreemoweet Jul 11 '14 at 3:05
  • As @kreemoweet pointed out, this doesn't address my question. The task doesn't need to run when the computer is idle, I would like it to run when I'm using the computer as well. – zants Jul 11 '14 at 3:31

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.