SUCCESS: The SID "S-1-5-17-2047162322-3971081939-4152322419-2583044571-537493394" for the username "Backup-Start Backup" has been computed successfully.
schtasks
Run alone, schtasks displays all task names, their next run time, and the status.
Schtasks delete example
SCHTASKS /Delete /TN "\Backup\Backup and Restore"
Delete the Backup and Restore scheduled task using schtasks.
Schtasks query example
SCHTASKS /Query /FO CSV /NH /V
Query the schedule tasks using schtasks and display all output in CSVformat.
Change the restore.exe taskname to Start Restore using schtasks.
Schtasks run example
SCHTASKS /Run /TN "\Backup\Start Backup"
Run the taskname Start Backup using schtasks.
Schtasks end example
SCHTASKS /End /TN "\Backup\Start Backup"
End the taskname Start Backup using schtasks.
Schtasks showsid example
SCHTASKS /ShowSid /TN "\Backup\Start Backup"
Running the above command would give results similar to the example below.
SUCCESS: The SID "S-1-5-17-2047162322-3971081939-4152322419-2583044571-537493394" for the username "Backup-Start Backup" has been computed successfully.
schtasks (在本地或远程系统上增删改查计划任务)
Schtasks命令使管理员可以在本地或远程系统上创建,删除,查询,更改,运行和结束计划任务。
The schtasks command enables an administrator to create, delete, query, change, run, and end scheduled tasks on a local or remote system.
查看英文版
查看中文版
1 schtasks 运行系统环境
2 schtasks 语法
3 schtasks 示例
schtasks 运行系统环境
Windows vista
Windows 7
Windows 8
Windows 10
schtasks 语法
指定运行任务的“运行方式”用户帐户(用户上下文)。
对于系统帐户,有效值为“”,“ NT AUTHORITY \ SYSTEM”或“ SYSTEM”。
对于v2任务,“ NT AUTHORITY \ LOCALSERVICE”和“ NT AUTHORITY \
NETWORKSERVICE”以及所有这三个的众所周知的SID也可用。
指定“运行方式”用户的密码。要提示输入密码,该值必须为“ *”或无
。系统帐户将忽略此密码。必须与/ RU或/ XML开关结合使用。
指定调度频率。有效的日程表类型:分钟,小时,每日,每周,每月
,一次,一次开始,一次登录,一次,一次,一次。
指定运行任务的星期几。有效值:MON,TUE,WED,THU
,FRI,SAT,SUN和MONTHLY日程表1-31(每月的天)。通配符 “ *”指定全天。
指定一年中的月份。默认为每月的第一天。有效值:JAN,FEB,MAR,APR,
MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC。通配符“ *”指定所有月份。
指定运行任务的开始时间。时间格式为HH:mm(24小时制),例如14:30表示
2:30 PM如果未指定/ ST,则默认为当前时间。/ SC ONCE需要此选项。
指定重复间隔(以分钟为单位)。该间隔不适用于时间表类型
:MINUTE,HOURLY,ONSTART,ONLOGON,ONIDLE,ONEVENT。
有效范围:1-599940分钟。如果指定了/ ET或/ DU,则默认为10分钟。
指定运行任务的结束时间。时间格式为HH:mm(24小时制),例如14:50表示
2:50 PM,不适用于时间表类型:ONSTART,ONLOGON,ONIDLE,ONEVENT。
指定运行任务的持续时间。时间格式为HH:mm,不适用于/ ET和时间表类型:
ONSTART,ONLOGON,ONIDLE和ONEVENT。对于/ V1任务,如果指定/ RI,则持续时间默认为1小时。
在结束时间或持续时间终止任务,不适用于计划类型:ONSTART,ONLOGON
,ONIDLE,ONEVENT。 必须指定/ ET或/ DU。
指定任务运行的第一个日期。格式是mm / dd / yyyy。默认为当前日期
,不适用于时间表类型:ONCE,ONSTART,ONLOGON,ONIDLE,ONEVENT。
指定任务应运行的最后日期。格式为mm / dd / yyyy,不适用于时间表类型
:ONCE,ONSTART,ONLOGON,ONIDLE和ONEVENT。
根据文件中指定的任务XML创建任务。当任务XML已经包含主体时,可以与/ RU和/ RP开关
结合使用,或者与/ RP单独结合使用。
指定触发触发器后延迟任务运行的等待时间。时间格式为mmmm:ss。此选项仅对日程表
类型ONSTART,ONLOGON,ONEVENT有效。
每个计划类型的/ MO开关的有效值:
跳转到包括schtasks删除示例的示例。
跳转到包括schtasks删除示例的示例。
以XML格式显示任务定义。 如果xml_type为ONE,则输出将是一个有效的XML文件。
如果不存在xml_type,则输出将是所有XML任务定义的串联。
跳转至包括schtasks查询示例的示例。
更改必须在其下运行计划任务的用户名(用户上下文)。对于系统帐户,
有效值为“”,“ NT AUTHORITY \ SYSTEM”或“ SYSTEM”。对于v2任务,
“ NT AUTHORITY \ LOCALSERVICE”和“ NT AUTHORITY \ NETWORKSERVICE”
以及所有这三个的众所周知的SID也可用。
使任务仅在作业运行时当前已登录/ RU用户时才能交互式运行。仅当用户登录
到计算机时,此任务才运行。
指定触发触发器后延迟任务运行的等待时间。时间格式为mmmm:ss。此选
项仅对日程表类型ONSTART,ONLOGON,ONEVENT有效。 ONEVENT.
跳转到包括schtasks更改示例的示例。
跳转至包括schtasks运行示例的示例。
跳转至包括schtasks结束示例的示例。
Specifies the remote system. If omitted, the system parameter
defaults to the local system.
Specifies the "run as" user account (user context) under which the task runs.
For the system account, valid values are "", "NT AUTHORITY\SYSTEM" or "SYSTEM".
For v2 tasks, "NT AUTHORITY\LOCALSERVICE" and"NT AUTHORITY\
NETWORKSERVICE" are also available as well as the well-known SIDs for all three.
Specifies the password for the "run as" user. To prompt for the password,
the value must be either "*" or none. This password is ignored for the system account.
Must be combined with either /RU or /XML switch.
Specifies the schedule frequency. Valid schedule types: MINUTE, HOURLY, DAILY,
WEEKLY, MONTHLY, ONCE, ONSTART, ONLOGON, ONIDLE, ONEVENT.
Refines the schedule type to allow finer control over schedule recurrence.
Valid values are listed in the modifiers section below.
Specifies the day of the week to run the task. Valid values: MON, TUE, WED, THU, FRI,
SAT, SUN and for MONTHLY schedules 1 - 31 (days of the month). Wildcard "*" specifies all days.
Specifies month(s) of the year. Defaults to the first day of the month. Valid values:
JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC. Wildcard "*" specifies all months.
Specifies the amount of idle time to wait before running a scheduled
ONIDLE task. Valid range: 1 - 999 minutes.
Specifies the path and file name of the program to be run at the scheduled time.
Example: C:\windows\system32\calc.exe
Specifies the start time to run the task. The time format is HH:mm
(24 hour time) for example,
14:30 for 2:30 P.M. Defaults to the current time if /ST is not specified.
This option is required with /SC ONCE.
Specifies the repetition interval in minutes. The interval is not applicable for schedule types:
MINUTE, HOURLY, ONSTART, ONLOGON, ONIDLE, ONEVENT. Valid range: 1 - 599940 minutes.
If either /ET or /DU is specified, then it defaults to 10 minutes.
Specifies the end time to run the task. The time format is HH:mm (24 hour time) for
example, 14:50 for 2:50 P.M. and is not applicable for schedule types:
ONSTART, ONLOGON, ONIDLE, ONEVENT.
Specifies the duration to run the task. The time format is HH:mm and is not applicable wit
h /ET and for schedule types: ONSTART, ONLOGON, ONIDLE, ONEVENT. For /V1 tasks,
if /RI is specified, duration defaults to 1 hour.
Terminates the task at the endtime or duration time and is not applicable for schedule types:
ONSTART, ONLOGON, ONIDLE, ONEVENT. Either /ET or /DU must be specified.
Specifies the first date on which the task runs. The format is mm/dd/yyyy.
Defaults to the current date and is not applicable for schedule types:
ONCE, ONSTART, ONLOGON, ONIDLE, ONEVENT.
Specifies the last date when the task should run. The format is mm/dd/yyyy and is not
applicable for schedule types: ONCE, ONSTART, ONLOGON, ONIDLE, ONEVENT.
Enables the task to run interactively only if the /RU user is currently logged on
at the time the job runs. This task runs only if the user is logged in to the computer.
No password is stored. The task runs non-interactively as the given user.
Only local resources are available.
Creates a task from the task XML specified in a file. Can be combined with /RU and /RP
switches, or with /RP alone, when task XML already contains the principal.
Specifies the wait time to delay the running of the task after the trigger is fired.The time
format is mmmm:ss. This option is only valid for schedule types
ONSTART, ONLOGON, ONEVENT.
Valid values for the /MO switch per schedule type:
Jump to examples including schtasks delete examples.
Specifies the name of the scheduled task to delete. Wildcard "*"
may be used to delete all tasks.
Forcefully deletes the task and suppresses warnings if the specified
task is currently running.
Jump to examples including schtasks delete examples.
Specifies that the column header should not display in the output
and is valid only for TABLE and CSV format.
If xml_type is ONE, the output will be one valid XML file.If xml_type is not
present, the output will be the concatenation of all XML task definitions.
Jump to examples including schtasks query examples.
Changes the username (user context) under which the scheduled task has to run.
For the system account, valid values are "", "NT AUTHORITY\SYSTEM" or "SYSTEM".
For v2 tasks, "NT AUTHORITY\LOCALSERVICE" and "NT AUTHORITY\NETWORKSER
VICE" are also available as well as the well-known SIDs for all three.
Specifies a new password for the existing user context or the password for a new user
account. This password is ignored for the system account.
Specifies the start time to run the task. The time format is HH:m
m (24 hour time) for example, 14:30 for 2:30 P.M.
Specifies the end time to run the task. The time format is HH:m
(24 hour time) for example, 14:50 for 2:50 P.M.
Specifies the duration to run the task. The time format is
HH:mm and is not applicable with /ET.
Enables the task to run interactively only if the /RU user is currently logged on at
the time the job runs. This task runs only if the user is logged in to the computer.
Sets the runlevel for the job. Valid values are LIMITED and HIGHEST.
The default is to not change it.
Specifies the wait time to delay the running of the task after the trigger is fired.
The time format is mmmm:ss. This option is only valid for schedule types
ONSTART, ONLOGON, ONEVENT.
Jump to examples including schtasks change examples.
Jump to examples including schtasks run examples.
Jump to examples including schtasks end examples.
查看英文版
查看中文版
schtasks 示例
单独运行时,schtasks显示所有任务名称,其下一个运行时间和状态。
Schtasks删除示例使用schtasks 删除“ 备份和还原”计划的任务。
Schtasks查询示例使用schtasks 查询调度任务,并以CSV格式显示所有输出。
Schtasks更改示例将restore.exe任务名更改为使用schtasks 开始还原。
Schtasks运行示例使用schtasks 运行任务名称“ 开始备份”。
Schtasks结束示例结束任务名称使用schtasks 启动备份。
Schtasks Showsid示例运行上面的命令将得到与以下示例类似的结果。
Run alone, schtasks displays all task names, their next run time, and the status.
Schtasks delete exampleDelete the Backup and Restore scheduled task using schtasks.
Schtasks query exampleQuery the schedule tasks using schtasks and display all output in CSVformat.
Schtasks change exampleChange the restore.exe taskname to Start Restore using schtasks.
Schtasks run exampleRun the taskname Start Backup using schtasks.
Schtasks end exampleEnd the taskname Start Backup using schtasks.
Schtasks showsid exampleRunning the above command would give results similar to the example below.
查看英文版
查看中文版
其他命令行
systemroot | systeminfo | sys | switches | sc | subst | start | sort | smartdrv | shutdown | shift | share | sfc | setver | setlocal | set | scandisk | scanreg |