0

I am trying to create a scheduled task from the command line. I need the task to run every day at 7:05pm and run for a maximum duration of 1 hour. Just once until the next day.

Here is my command:

schtasks.exe /create /ru DeployUser /rp '********' /tn "Run All Tasks" /tr "'tasks.exe RunAllTasks'" /sc DAILY /st 19:05:00 /F /du 01:00

That command produces the following trigger.

At 7:05 PM every day - After triggered, repeat every 10 minutes for a duration of 1 hour.

The repeating every 10 minutes is not desirable and I do not see where in my command this was requested. Maybe it is a default for using duration, is there a way to get rid of it?

1
  • It would have been nice if there was the option of cron syntax – user55570 Jul 14 '18 at 20:24
1

Having the same problem here. I've found it is a default setting when you use either the /ET or /DU switch.

Frustratingly I haven't yet figured out how to stop the repeat applying when using either of the switches.

Here's the bit from the technet that I found it in:

https://technet.microsoft.com/en-us/library/cc725744(v=ws.11).aspx#BKMK_change

/ri Specifies the repetition interval in minutes. This is not applicable for schedule types: MINUTE, HOURLY, ONSTART, ONLOGON, and ONIDLE. Valid range is 1 to 599940 minutes (599940 minutes = 9999 hours). If either /ET or /DU is specified, then the repetition interval defaults to 10 minutes.

Doesn't answer the question but hopefully provides a bit of clarity.

The closest suggestion I've found to an answer is to create a second task that ends the first one: schtasks /end /tn TaskName

0
0

From technet:

/ri <Interval>

Specifies the repetition interval in minutes. This is not applicable for schedule types: MINUTE, HOURLY, ONSTART, ONLOGON, and ONIDLE. Valid range is 1 to 599940 minutes (599940 minutes = 9999 hours). If either /ET or /DU is specified, then the repetition interval defaults to 10 minutes.

You should add /ri of 24 hours (/ri 1440). The wording of the quote implies that you can change the repeat interval from the default with /ri.

1
  • how will daylight savings time affect this setting? I used /sc DAILY to assure I run at a specific time 7:05PM but with /ri 1440 it seems the run time would change from 7:05PM to 8:05PM (or 6:05PM) depending on when i initiate the task setup. Am I wrong with this assumption? – Rob S. Nov 10 '16 at 15:49
0

To suppress repeat period - use key "/ri 0"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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