Repetition (triggerBaseType) Element

Specifies how often the task is run and how long the repetition pattern is repeated after the task is started.

<xs:element name="Repetition"
    type="repetitionType"
 />

The Repetition element is defined by the triggerBaseType complex type.

Parent element

Element Derived from Description
BootTrigger bootTriggerType Specifies a trigger that starts a task when the system is booted.
CalendarTrigger calendarTriggerType Specifies a daily, weekly, monthly, or a monthly day-of-the-week (DOW) trigger.
EventTrigger eventTriggerType Specifies a trigger that starts a task when a system event occurs.
IdleTrigger idleTriggerType Specifies a trigger that starts a task when the computer goes into an idle state.
LogonTrigger logonTriggerType Specifies a trigger that starts a task when a user logs on.
RegistrationTrigger registrationTriggerType Specifies a trigger that starts a task when the task is registered.
TimeTrigger timeTriggerType Specifies a trigger that starts a task when the trigger is activated.

Child elements

Element Type Description
Duration duration Specifies how long the pattern is repeated.
Interval duration Specifies the amount of time between each restart of the task.
StopAtDurationEnd boolean Specifies that a running instances of the task is stopped at the end of the repetition pattern duration.

Remarks

If you specify a repetition duration for a task, you must also specify the repetition interval.

If you register a task that contains a trigger with a repetition interval equal to one minute and a repetition duration equal to four minutes, the task will be launched five times. The five repetitions can be defined by the following pattern.

  1. A task starts at the beginning of the first minute.
  2. The next task starts at the end of the first minute.
  3. The next task starts at the end of the second minute.
  4. The next task starts at the end of the third minute.
  5. The next task starts at the end of the fourth minute.

Windows Server 2003, Windows XP and Windows 2000: If you register a task that contains a trigger with a repetition interval equal to one minute and a repetition duration equal to four minutes, the task will be launched four times.

Windows Vista, Windows 7, Windows Server 2008, Windows 8 and Windows Server 2012: Usually, setting the repetition duration to an exact multiple of the interval yields the numbers described above. However, under certain heavy load conditions, it is possible for the duration to timeout before TaskScheduler can launch the final task interval.

For scripting development, the repetition pattern is specified using the Trigger.Repetition property that is inherited by all the trigger objects.

For C++ development, the repetition pattern is specified using the ITRigger::Repetition property that is inherited by all the trigger interfaces.

Examples

The following XML defines a boot trigger element that specifies a repetition pattern for a trigger.

<BootTrigger>
    <StartBoundary>2005-01-01T08:00:00</StartBoundary>
    <EndBounadry>2007-01-01T08:00:00</EndBoundary>
    <Enabled>true</Enabled>
    <Repetition>
        <Interval></Interval>
        <Duration></Duration>
        <StopAtDurationEnd>true</StopAtDurationEnd>
    </Repetition>
    <ExecutionTimeLimit></ExecutionTimeLimit>
    <Delay><Delay>
 </BootTrigger>

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]

See also

Task Scheduler Schema Elements

Task Scheduler