I have a problem with writing a script to automate the creation of Scheduled Tasks in Windows.

After much Googling, I am unable to deduce which parameters to the command-line utility SCHTASKS.EXE control the setting "Stop the task if it runs for hours."

link|improve this question
feedback

1 Answer

Your best would would probably be the /DU switch.

/DU duration

A value that specifies the duration to run the task. The time format is HH:mm (24-hour time). For example, 14:50 specifies 2:50PM. This is not applicable with /ET and for the following schedule types: ONSTART, ONLOGON, ONIDLE, and ONEVENT. For /V1 tasks (Task Scheduler 1.0 tasks), if /RI is specified, then the duration default is one hour.

Windows XP: This option is not available.

Quoted from MSDN. Why that information isn't in the TechNet Library page for schtasks is beyond me.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.