Muokkaa

Jaa


Settings (taskType) Element

Specifies the settings that the Task Scheduler uses to perform the task.

<xs:element name="Settings"
    type="settingsType"
    minOccurs="0"
 />

The Settings element is defined by the taskType complex type.

Parent element

Element Derived from Description
Task taskType Specifies the task that is performed by the Task Scheduler service.

Child elements

Element Type Description
AllowHardTerminate boolean Specifies that the task may be terminated using TerminateProcess.
AllowStartOnDemand boolean Specifies that the task can be started using either the Run command or the Context menu.
DeleteExpiredTaskAfter duration Specifies the amount of time that the Task Scheduler will wait before deleting the task after it expires.
DisallowStartIfOnBatteries boolean Specifies that the task will not be started if the computer is running on batteries.
Enabled boolean Specifies that the task is enabled. The task can be performed only when this setting is True.
ExecutionTimeLimit duration Amount of time allowed to complete the task.
Hidden boolean Specifies that the task will not be visible in the UI by default.
IdleSettings idleSettingsType Specifies how the Task Scheduler performs tasks when the computer is in an idle state.
MaintenanceSettings maintenanceSettingsType Specifies how the Task Scheduler performs tasks during Automatic maintenance.
MultipleInstancesPolicy multipleInstancesPolicyType Specifies the policy that defines how the Task Scheduler deals with multiple instances of the task.
Priority priorityType Specifies the priority level for the task.
RestartOnFailure restartType Specifies that the Task Scheduler will attempt to restart the task if the task fails for any reason.
RunOnlyIfIdle boolean Specifies that the task is run only when the computer is in an idle state.
RunOnlyIfNetworkAvailable boolean Specifies that the Task Scheduler will run the task only when a network is available.
StartWhenAvailable boolean Specifies that the Task Scheduler can start the task at any time after its scheduled time has passed.
StopIfGoingOnBatteries (settingsType) boolean Specifies that the task will be stopped if the computer is going onto batteries.
Volatile boolean Specifies if the task is automatically disabled by Task Scheduler at Windows startup.
WakeToRun (settingsType) boolean Specifies that Task Scheduler will wake the computer when it is time to run the task.

Remarks

You can select one or more of the child elements referenced above.

For C++ development, the registration information of a task is specified using the Settings property of ITaskDefinition.

For scripting development, the registration information of a task is specified using the TaskDefinition.Settings property.

Examples

The following XML code example defines a settings element that allows a hard termination of the task.

<task>
    <Settings>
        <AllowHardTerminate>true</AllowHardTerminate>
        <AllowStartOnDemand>true</AllowStartOnDemand>
    </Settings>
</task>

For more information and a complete example of the XML for setting task settings, see Time Trigger Example (XML).

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