任务计划程序:
Windows + R / taskschd.msc
1.可在面板根据需要添加定时任务:Link
2.根据 schtasks 命令添加,按需配置
schtasks /create /sc <scheduletype> /tn <taskname> /tr <taskrun> [/s <computer> [/u [<domain>\]<user> [/p <password>]]] [/ru {[<domain>\]<user> | system}] [/rp <password>] [/mo <modifier>] [/d <day>[,<day>...] | *] [/m <month>[,<month>...]] [/i <idletime>] [/st <starttime>] [/ri <interval>] [{/et <endtime> | /du <duration>} [/k]] [/sd <startdate>] [/ed <enddate>] [/it] [/z] [/f]
2.1.每天执行命令
schtasks /create /tn "Cust.Task1" /tr c:\apps\myapp.exe /sc daily /st 07:00:00
2.2.删除命令
schtasks /create /tn "Cust.Task1"
2.3.查看定时任务列表
schtasks
2.4.立刻运行定时任务
schtasks /run /tn "Cust.Task1"
2.5.如果需要给服务器添加定时任务,需要指定:/s /u /p
Reference:
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks-create
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks-delete