Windows 任务计划程序中的链式触发器

发布于 2024-12-06 11:56:28 字数 163 浏览 0 评论 0原文

我在 Windows 任务计划程序中安排了一些任务。我安装了一个名为 Bmail 的第三方工具,它添加了一个从任务计划程序独立发送电子邮件的任务。它可以在给定时间触发。有谁知道如何进行设置,以便 Bmail 任务在运行原始任务时发送电子邮件?如何在任务计划程序中链接两个不同的任务并让其中一个任务触发另一个任务?

I scheduled some tasks in Windows task scheduler. I installed a third party tool called Bmail that added a task that sends email from the task scheduler independently. It can be triggered at a given time. Does any one know how to set this up so that Bmail task sends emails when the original tasks are run? How do I link two different tasks in task scheduler and have one trigger the other?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

堇色安年 2024-12-13 11:56:28

抱歉,如果这被认为是旧线程的复活。但我自己想回答这个问题,所以先来到这里。

您可以将它们以菊花链形式连接起来。在第一个任务之后,安排第二个任务在第一个任务完成时创建的事件上触发。这里的解释有点混乱, https://blogs.msdn.microsoft.com/davethompson/2011/10/25/running-a-scheduled-task-after-another/

通过添加此触发器并触发 Ping 事件,Pong 任务将触发
Ping 完成后立即。现在是一个简单的情况
重用此 XPath,将任务名称 \Ping 替换为任务
追随:

*[EventData[@Name='TaskSuccessEvent'][Data[@Name='TaskName']='\Ping']]

如果您想要更多控制,您可以按照评论员之一的方式进行操作上面链接的博客。

我进一步添加了条件“仅在以下情况下才执行任务”
前一个已完成,退出代码为 0"。

为了做到这一点,“操作完成”事件比
“任务完成”一。此“操作”的事件数据元素
Completed”事件包含另一个子元素,其名称为
“ResultCode”正是我们正在寻找的!

所以 xPath 是:
*[EventData[@Name='ActionSuccess'][Data[@Name='TaskName']='Ping'][Data[@Name='ResultCode']='0']]

当我我自己已经可以工作了。

Sorry if this is considered resurection of an old thread. But i wanted answer on this myself and came here first.

You can have them daisy chained. After the first task, schedule the 2nd task to trigger on the event created when the first task completes. It's all explained a bit messy here, https://blogs.msdn.microsoft.com/davethompson/2011/10/25/running-a-scheduled-task-after-another/

By adding this trigger, and firing the Ping Event, the Pong Task Fires
immediately after the Ping is complete. It is now a simple case of
reusing this XPath replacing the Task Name, \Ping here, with the task
to run after:

*[EventData[@Name='TaskSuccessEvent'][Data[@Name='TaskName']='\Ping']]

If you want even more control, you can do as one of the commentators done in the blog linked above.

I've gone further by adding the condition "executing a task only if
the previous was completed with the exit code 0".

In order to do that, the "Action completed" event is better than the
"task completed" one. The Event Data element of this "Action
completed" event contains one more child element with the name
"ResultCode" which is exactly what we are looking for !

So the xPath is :
*[EventData[@Name='ActionSuccess'][Data[@Name='TaskName']='Ping'][Data[@Name='ResultCode']='0']]

I will update this post more when i've got it to work myself.

苦笑流年记忆 2024-12-13 11:56:28

您可以编写一个脚本来模拟 Bmail 任务正在执行的操作(例如,运行 exe 等),然后更改 Bmail 任务以运行您刚刚编写的脚本。

从那里更改原始任务以调用相同的脚本,这样,如果 Bmail 更改了它们的运行方式,您可以更新这两个任务,但只需更改脚本即可。

You could write a script to emulate what the Bmail task is doing (e.g. Run exe, etc), then change the Bmail task to run that script you just wrote.

From there change the original task to call the same script, this way, if Bmail changes something on how they run, you could update both tasks but simply changing the script.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文