Trigger a scheduled task upon completion of a different scheduled task

余生长醉 提交于 2020-12-06 12:33:49

问题


I run a few weekly reports with python scripts and excel macros - each runs for a few hours, and must be done after midnight Monday morning. Task scheduler is the perfect tool for me! I'd like to get more efficient however. I would like to schedule these to start once the previous completes (instead of just guessing a time.) I see that I can begin the task 'On an event' and with a custom filter I can get really close to what I want... can one of you wizards help me out? I bet my right arm that I need to edit the XML code to be when task XYZ is = ### but I just don't know XML :(


回答1:


This custom XML executes a task after the completion of FirstTask:

<QueryList>
  <Query Id="0" Path="Microsoft-Windows-TaskScheduler/Operational">
    <Select Path="Microsoft-Windows-TaskScheduler/Operational">*[EventData [@Name='TaskSuccessEvent'][Data[@Name='TaskName']='\FirstTask']]</Select>
  </Query>
</QueryList>

Adapted from: http://blogs.msdn.com/b/davethompson/archive/2011/10/25/running-a-scheduled-task-after-another.aspx




回答2:


The way I solved this was to have the actions in the order I wanted in my task scheduler. So the first was triggered by a time, and I had 4 actions after. Windows knows to do them in order.

Hope this helps!



来源:https://stackoverflow.com/questions/34234995/trigger-a-scheduled-task-upon-completion-of-a-different-scheduled-task

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!