Windows下的定时任务

计划任务每 20 分钟运行一次。
schtasks /create /sc minute /mo 20 /tn "Security Script" /tr c:appsmyapp.exe
计划命令每五小时运行一次
schtasks /create /sc hourly /st 00:05:00 /tn "My App" /tr c:appsmyapp.exe
计划任务每天运行一次
schtasks /create /tn "My App" /tr c:appsmyapp.exe /sc daily /st 08:00:00 /ed 12/31/2001
计划任务每隔一天运行一次
schtasks /create /tn "My App" /tr c:appsmyapp.exe /sc daily /mo 2 /st 13:00:00 /sd 12/31/2001

计划任务每六周运行一次
schtasks /create /tn "My App" /tr c:appsmyapp.exe /sc weekly /mo 6 /s Server16 /ru Admin01
计划任务每隔一周在周五运行
schtasks /create /tn "My App" /tr c:appsmyapp.exe /sc weekly /mo 2 /d FRI

计划任务在每月的第一天运行

下面的命令计划 MyApp 程序在每月的第一天运行。因为默认修饰符是 none(即:没有修饰符),默认天是第一天,默认的月份是每个月,所以该命令不需要任何其它的参数。

schtasks /create /tn "My App" /tr c:appsmyapp.exe /sc monthly
计划任务在每月的最后一天运行

下面的命令计划 MyApp 程序在每月的最后一天运行。它使用/mo参数指定在每月的最后一天运行程序,使用通配符 (*) 与/m参数表明在每月的最后一天运行程序。

schtasks /create /tn "My App" /tr c:appsmyapp.exe /sc monthly /mo lastday /m *
计划任务每三个月运行一次

下面的命令计划 MyApp 程序每三个月运行一次。.它使用/mo参数来指定间隔。

schtasks /create /tn "My App" /tr c:appsmyapp.exe /sc monthly /mo 3
计划任务在每月的第二个周日运行

下面的命令计划 MyApp 程序在每月的第二个周日运行。它使用/mo参数指定是每月的第二周,使用/d参数指定天。

schtasks /create /tn "My App" /tr c:appsmyapp.exe /sc monthly /mo SECOND /d SUN
计划任务在五月和六月的第 15 天运行。

下面的命令计划 MyApp 程序在五月 15 日和六月 15 日的 3:00 PM (15:00) 运行。它使用/d参数来指定日期,使用/m参数指定月份。它也使用/st参数来指定开始时间。

schtasks /create /tn "My App" /tr c:appsmyapp.exe /sc monthly /d 15 /m MAY,JUN /st 15:00:00

原文地址:https://www.cnblogs.com/king-/p/4095121.html