windows - Why do I get "could not start" for this task?

07
2014-07
  • ManInMoon

    I am trying to use schtasks for first time on window 2008.

    It appears to work but when I check I get "Could not start". WHen I go to .exe in explorer and double-click - it runs.

    SchTasks /Create /SC MINUTE  /TN CheckHS /TR "C:\StartTest.exe"
    
    SUCCESS: The scheduled task "CheckHS" has successfully been created.
    
    
    C:\Users\moon>schtasks /query
    
    Folder: \
    TaskName                                 Next Run Time          Status
    ======================================== ====================== ===============
    CheckHS                                  5/15/2014 8:22:00 AM   Could not start
    
  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

    Related Question

    windows - Scheduled tasks run slower than command-line tasks?
  • Nikhil

    I have noticed that tasks run via the "Task Scheduler" in Windows 2008 run much slower than when run from the command line. I even tried upping the priority of the task (export task to XML -> change priority -> import task to the task scheduler), but that did not seem to help.

    Is this by design? Is there any way to make sure that the tasks run via the Task Scheduler get all the resources at about the same priority as the tasks run via the command-line?


  • Related Answers
  • ChrisF

    Windows will give the user interface priority, which is why something run direct from the command prompt might run more quickly.

    Have you added some timings to your task to prove this?

    Also is it that important that the task completes by a certain time?

  • mauvedeity

    Windows does not give the user interface priority. What it does is to give the current foreground application a priority boost. This makes it seem more responsive, and is basically a trick to make your system feel more responsive than it is. All other processes normally run with normal priority. This applies to all versions of Windows since just about forever (Windows NT 4 if I recall correctly).

    As such, this is by design. Tasks run via the Task Scheduler do get CPU and other resources at about the same priority as tasks run from anywhere else. The only difference is that tasks from Task Scheduler can't usually become the foreground program, and hence never get the priority boost. This is usually not a problem, because you are not normally sitting there waiting for the result from a scheduled task.

    On the other hand, if running the task from the command line does what you want, then do that.