如何在Windows 2003 Task Scheduler中为任务创建不确定的持续时间 [英] How to Create Indefinite Duration for a Task in Windows 2003 Task Scheduler
本文介绍了如何在Windows 2003 Task Scheduler中为任务创建不确定的持续时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建无限期的任务。在Windows Server 2008上,如果我未指定持续时间,则假定持续时间是无限的。但是,在Windows Server 2003上,必须指定持续时间(并且该持续时间等于或大于间隔)。目前,如果要重复很长时间,我只是将任务设置为一年。
I'm trying to create tasks with an indefinite duration. On Windows Server 2008, if I don't specify the duration, then the duration is assumed infinite. However, on Windows Server 2003 a duration must be specified (and be equal or greater than the interval). Currently, I am just setting the task to have a duration of a year if it is meant to repeat a long time.
是否可以在Windows Server 2003上指定无限期?
if (m_TimeInterval.m_Expire.Year < 2099) //xp and win7 max year is 2099
tTrigger.Repetition.Duration = m_TimeInterval.getDuration();
else if (!newVer) tTrigger.Repetition.Duration = m_TimeInterval.getInterval().Add(TimeSpan.FromDays(365));
tTrigger.Repetition.Interval = m_TimeInterval.getInterval();
tTrigger.Repetition.StopAtDurationEnd = true;
注意:
- 我正在使用Task Scheduler API添加这些任务定义。
- 时间间隔和持续时间是通过使用TimeSpans来设置的。
-
newVer
是错误的,因为我正在使用Task Scheduler 1.1而不是1.2或更高版本 -
tTrigger
的类型为TimeTrigger
- I am using the Task Scheduler API to add these task definitions.
- Interval and Duration are set by use of TimeSpans.
newVer
is false since I am working with Task Scheduler 1.1 and not 1.2 or highertTrigger
is of type TimeTrigger
推荐答案
我最终将1-1-2099用作不确定
I ended up using 1-1-2099 as 'indefinite'
这篇关于如何在Windows 2003 Task Scheduler中为任务创建不确定的持续时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文