Anda di halaman 1dari 7

Schtasks.

exe
Enables an administrator to create, delete, query, change, run, and end scheduled tasks on a local or remote computer. Running Schtasks.exe without
arguments displays the status and next run time for each registered task.
Creating a Task
The following syntax is used to create a task on the local or remote computer.
Copy
schtasks /Create
[/S system [/U username [/P [password]]]]
[/RU username [/RP [password]] /SC schedule [/MO modifier] [/D day]
[/M months] [/ idletime] /!" taskname /!R taskrun [/S! starttime]
[/R inter#al] [ $/%! endtime & /DU duration' [/(]
[/)M* +mlfile] [/,-]] [/SD startdate] [/%D enddate] [/!] [/.] [//]
Parameters
/S system
!alue that specifies the remote computer to connect to. "f omitted, the system parameter defaults to the local computer.
/U username
!alue that specifies the user context under which Schtasks.exe should run.
/P [password]
!alue that specifies the password for a gi!en user context. "f omitted, Schtasks.exe prompts the user for input.
/RU username
!alue that specifies the user context under which the task runs. #or the system account, !alid !alues are $$, $%T &T'(R"T)*S)STE+$, or
$S)STE+$. #or Task Scheduler ,.- tasks, $%T &T'(R"T)*.(C.SER/"CE$, and $%T &T'(R"T)*%ET0(R1SER/"CE$ are also !alid
!alues.
/RP [password]
!alue that specifies the password for the user specified with the 2R& parameter. To prompt for the password, the !alue must be either $3$ or no
!alue. This password is ignored for the system account. This parameter must be combined with either 2R& or the 24+. switch.
/SC schedule
!alue that specifies the schedule frequency. /alid !alues are5 +"%&TE, '(&R.), 6".), 0EE1.), +(%T'.), (%CE, (%.(7(%, (%"6.E,
and (%E/E%T.
/! modi"ier
!alue that refines the schedule type to allow for finer control o!er the schedule recurrence. /alid !alues are5
+"%&TE5 8 9 8:;< minutes.
'(&R.)5 8 9 ,; hours.
6".)5 8 9 ;=> days.
0EE1.)5 weeks 8 9 >,.
(%CE5 %o modifiers.
(%STRT5 %o modifiers.
(%.(7(%5 %o modifiers.
(%"6.E5 %o modifiers.
+(%T'.)5 8 9 8,, or #"RST, SEC(%6, T'"R6, #(&RT', .ST,
and .ST6).
(%E/E%T5 4?ath e!ent query string.
/# days
!alue that specifies the day of the week to run the task. /alid !alues are5 +(%, T&E, 0E6, T'&, #R", ST, S&% and for +(%T'.) schedules 8
9 ;8 @days of the monthA. The wildcard character @3A specifies all days.
/ months
!alue that specifies months of the year. 6efaults to the first day of the month. /alid !alues are5 B%, #EC, +R, ?R, +), B&%, B&., &7,
SE?, (CT, %(/, and 6EC. The wildcard character @3A specifies all months.
/$ idletime
!alue that specifies the amount of idle time to wait before running a scheduled (%"6.E task. The !alid range is 8 9 <<< minutes.
/T% taskname
!alue that specifies a name which uniquely identifies the scheduled task.
/TR taskrun
!alue that specifies the path and file name of the task to be run at the scheduled time. #or example5 C5*0indows*System;,*calc.exe.
/ST starttime
!alue that specifies the start time to run the task. The time format is ''5mm @,:9hour timeA. #or example, 8:5;- specifies ,5;-?+. The default is
the current time is 2ST is not specified. This option is required wit the 2SC (%CE argument.
/R$ inter&al
!alue that specifies the repetition inter!al in minutes. This is not applicable for the following schedule types5 +"%&TE, '(&R.), (%STRT,
(%.(7(%, (%"6.E, and (%E/E%T. The !alid range is 8 9 ><<<:- minutes. "f either the 2ET or 26& parameters are specified, the default is 8-
minutes.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/-T endtime
!alue that specifies the end time to run the task. The time format is ''5mm @,:9hour timeA. #or example, 8:5>- specifies ,5>-?+. This is not
applicable for the following schedule types5 (%STRT, (%.(7(%, (%"6.E, and (%E/E%T.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/#U duration
!alue that specifies the duration to run the task. The time format is ''5mm @,:9hour timeA. #or example, 8:5>- specifies ,5>-?+. This is not
applicable with 2ET and for the following schedule types5 (%STRT, (%.(7(%, (%"6.E, and (%E/E%T. #or 2/8 tasks @Task Scheduler 8.-
tasksA, if 2R" is specified, then the duration default is one hour.
'indows (P, This option is not a!ailable.
/.
!alue that terminates the task at the end time or duration time. This is not applicable for the following schedule types5 (%STRT, (%.(7(%,
(%"6.E, and (%E/E%T. Either 2ET or 26& must be specified.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/S# startdate
!alue that specifies the first date on which to run the task. The format is mm2dd2yyyy. This !alue defaults to the current date. This is not applicable
for the following schedule types5 (%CE, (%STRT, (%.(7(%, (%"6.E, and (%E/E%T.
/-# enddate
!alue that specifies the last date that the task will run. The format is mm2dd2yyyy. This is not applicable for the following schedule types5 (%CE,
(%STRT, (%.(7(%, (%"6.E, and (%E/E%T.
/-C Channel%ame
!alue that specifies the e!ent channel for (%E/E%T triggers.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/$T
!alue that enables the task to run interacti!ely only if the 2R& user is currently logged on at the time the task runs. The task runs only if the user is
logged on.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/%P
!alue that indicates that no password is stored. The task does not run interacti!ely as the gi!en user. (nly local resources are a!ailable.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
//
!alue that marks the task to be deleted after its final run.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/(0 xml"ile
!alue that creates a task from an 4+. file. This parameter can be combined with 2R& and 2R? switches, or with the 2R? switch alone when the task
4+. already contains the principal.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/12
!alue that creates a task !isible to 0indows ,---, 0indows Ser!er ,--;, and 0indows 4? platforms.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/3
!alue that forcefully creates the task and suppresses warnings if the specified task already exists.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/R0 le&el
!alue that sets the run le!el for the task. /alid !alues are ."+"TE6 and '"7'EST. The default is ."+"TE6.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/#-045 delaytime
!alue that specifies the wait time to delay the task after the trigger is fired. The time format is mmmm5ss. This option is only !alid for schedule
types (%STRT, (%.(7(%, and (%E/E%T.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/6
!alue that displays the help message for Schtasks.exe.
Remarks
0hen creating a task on a remote computer running on the 0indows 4?, 0indows Ser!er ,--;, or 0indows ,--- operating system, use the 2/8
switch.
)ou cannot create a non9interacti!e remote Task Scheduler 8.- task @create a task by not using the 2"T switch and using the 2/8 switchA if the remote
computer has the #ile and ?rinter Sharing firewall exception enabled and the Remote Scheduled Tasks +anagement firewall exception disabled.
#eleting a Task
The following syntax is used to delete one or more scheduled tasks.
Copy
schtasks /Delete
[/S system [/U username [/P [password]]]]
[/!" taskname] [//]
Parameters
/S system
!alue that specifies the remote computer to connect to. "f omitted, the system parameter defaults to the local computer.
/U username
!alue that specifies the user context under which Schtasks.exe should run.
/P [password]
!alue that specifies the password for the gi!en user context. "f omitted, Schtasks.exe prompts the user for input.
/T% taskname
!alue that specifies the name of the scheduled task to delete. The wildcard character @3A can be used to delete all tasks.
/3
!alue that forcefully deletes the task and suppresses warnings if the specified task is running.
/6
!alue that displays 'elp for Schtasks.exe.
Running a Task
The following syntax is used to immediately run a scheduled task.
Copy
schtasks /Run
[/S system [/U username [/P [password]]]]
/!" taskname
Parameters
/S system
!alue that specifies the remote computer to connect to. "f omitted, the system parameter defaults to the local computer.
/U username
!alue that specifies the user context under which Schtasks.exe should run.
/P [password]
!alue that specifies the password for the gi!en user context. "f omitted, Schtasks.exe prompts the user for input.
/T% taskname
!alue that specifies the name of the scheduled task to run.
/6
!alue that displays 'elp for Schtasks.exe.
-nding a Running Task
The following syntax is used to stop a running scheduled task.
%ote To stop a remote task from running, ensure that the remote computer has the #ile and ?rinter Sharing and Remote Scheduled Tasks
+anagement firewall exceptions enabled.
Copy
schtasks /%nd
[/S system [/U username [/P [password]]]]
/!" taskname
Parameters
/S system
!alue that specifies the remote computer to connect to. "f omitted, the system parameter defaults to the local computer.
/U username
!alue that specifies the user context under which Schtasks.exe should run.
/P [password]
!alue that specifies the password for the gi!en user context. "f omitted, Schtasks.exe prompts the user for input.
/T% taskname
!alue that specifies the name of the scheduled task to stop.
/6
!alue that displays 'elp for Schtasks.exe.
7uerying "or Task $n"ormation
The following syntax is used to display the scheduled tasks from the local or remote computer.
Copy
schtasks /0uery
[/S system [/U username [/P [password]]]]
[//O format & /)M*] [/"1] [/,] [/!" taskname] [/2]
Parameters
/S system
!alue that specifies the remote computer to connect to. "f omitted, the system parameter defaults to the local computer.
/U username
!alue that specifies the user context under which Schtasks.exe should run.
/P [password]
!alue that specifies the password for the gi!en user context. "f omitted, Schtasks.exe prompts the user for input.
/3! "ormat
!alue that specifies the output format. The !alid !alues are TC.E, ."ST, and CS/.
/%8
!alue that specifies that the column header should not be displayed in the output. This is !alid only for TC.E and CS/ formats.
/1
!alue that displays !erbose task output.
%ote "f a task was scheduled to run only one time, then the displayed schedule information is $Scheduling data is not a!ailable in this
format.$
/T% taskname
!alue that specifies the task name for which to retrie!e the information. "f no task name is specified, then information for all the tasks will be
displayed.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/(0
!alue that is used to display the task definitions in 4+. format.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/6
!alue that is used to display the 'elp for Schtasks.exe.
Changing a Task
The following syntax is used to change how the program runs, or change the user account and password used by a scheduled task.
Copy
schtasks /Chan3e
[/S system [/U username [/P [password]]]] /!" taskname
$ [/RU runasuser] [/RP runaspassword] [/!R taskrun] [/S! starttime]
[/R inter#al] [ $/%! endtime & /DU duration' [/(] ]
[/SD startdate] [/%D enddate] [/%"45*% & /DS45*%] [/!] [/.] '
Parameters
/S system
!alue that specifies the remote computer to connect to. "f omitted, the system parameter defaults to the local computer.
/U username
!alue that specifies the user context under which Schtasks.exe should run.
/P [password]
!alue that specifies the password for the gi!en user context. "f omitted, Schtasks.exe prompts the user for input.
/T% taskname
!alue that specifies which scheduled task to change.
/RU runasuser
!alue that changes the user name @user contextA under which the scheduled task will run. #or the system account, !alid !alues are $$, $%T
&T'(R"T)*S)STE+$, or $S)STE+$. #or Task Scheduler ,.- tasks, $%T &T'(R"T)*.(C.SER/"CE$ and $%T
&T'(R"T)*%ET0(R1SER/"CE$ are also !alid !alues.
/RP runaspassword
!alue that 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.
/TR taskrun
!alue that specifies a new program that the task will run.
/ST starttime
!alue that specifies the start time to run the task. The time format is ''5mm @,:9hour timeA. #or example, 8:5;- specifies ,5;-?+.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/R$ inter&al
!alue that specifies the repetition inter!al, in minutes. The !alid range is 8 9 ><<<:- minutes.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/-T endtime
!alue that specifies the end time for the task. The time format is ''5mm @,:9hour timeA. #or example, 8:5>- specifies ,5>-?+.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/#U duration
!alue that specifies the duration to run the task. The time format is ''5mm @,:9hour timeA. #or example, 8:5>- specifies ,5>-?+. This is not
applicable with the 2ET parameter.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/.
!alue that terminates the task at the end time or duration time.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/S# startdate
!alue that specifies the first date on which to run the task. The format is mm2dd2yyyy.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/-# enddate
!alue that specifies the last date that the task will run. The format is mm2dd2yyyy.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/$T
!alue that enables the task to run interacti!ely only if the 2R& user is currently logged on at the time the task runs. The task runs only if the user is
logged on.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/R0 le&el
!alue that sets the run le!el for the task. /alid !alues are ."+"TE6 and '"7'EST.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/-%490-
!alue that enables the scheduled task. n enabled task can run, and a disabled task cannot run.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/#$S490-
!alue that disables the scheduled task from running.
%ote "f a remote Task Scheduler 8.- task is disabled by Schtasks.exe and the remote computer has the #ile and ?rinter Sharing firewall
exception enabled and the Remote Scheduled Tasks +anagement firewall exception disabled, then the task will not be disabled when read from a
Task Scheduler ,.- ?".
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
//
!alue that marks the task to be deleted after its final run.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/#-045 delaytime
!alue that specifies the wait time to delay the running of the task after the trigger is fired. The time format is mmmm5ss. This option is only !alid
for tasks with the schedule types (%STRT, (%.(7(%, and (%E/E%T.
'indows (P and 'indows Ser&er )**+, This option is not a!ailable.
/6
!alue that displays the 'elp message for Schtasks.exe.
Re:uirements
inimum supported client 0indows 4? Ddesktop apps onlyE
inimum supported ser&er 0indows Ser!er ,--; Ddesktop apps onlyE