System command

schtasks command

Query and manage scheduled tasks.

Availability: Microsoft Learn command reference spanning Windows client and Windows Server releases; some entries are legacy, role-specific, optional-feature or interactive subcommands.中文

Documented syntax

schtasks /change /tn <Taskname> [/s <computer> [/u [<domain>\]<user> [/p <password>]]] [/ru <username>] [/rp <password>] [/tr <Taskrun>] [/st <Starttime>] [/ri <interval>] [/rl <level>] [{/et <Endtime> | /du <duration>} [/k]] [/sd <Startdate>] [/ed <Enddate>] [/{ENABLE | DISABLE}] [/it] [/z]
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] [/np] [/z] [/xml <xmlfile>] [/v1] [/f] [/rl <level>] [/delay <delaytime>] [/hresult]
schtasks /delete /tn {<taskname> | *} [/f] [/s <computer> [/u [<domain>\]<user> [/p <password>]]]
schtasks /end /tn <taskname> [/s <computer> [/u [<domain>\]<user> [/p <password>]]]
schtasks /query [/fo {TABLE | LIST | CSV}] [/nh] [/v] [/s <computer> [/u [<domain>\]<user> [/p <password>]]] [/tn <taskname>] [/xml] [/hresult]
schtasks /run /tn <taskname> [/s <computer> [/u [<domain>\]<user> [/p <password>]]]

The linked Microsoft Learn article is the upstream authority. Availability may depend on Windows release, role, optional feature or interactive tool context.

Examples

Example usage for schtasks.

schtasks /query /fo LIST /v

Example from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.

schtasks /create /tn "Daily Report" /tr C:\Scripts\report.cmd /sc daily /st 09:00

Example from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.

schtasks /run /tn "Daily Report"

Parameters, options and clauses

Option / clauseDescription
/change /create /delete /end /query /runSelect the operation to modify, create, remove, stop, list or start a task.
/tn <taskname>Identify a task by its name and optional task-folder path.
/tr <taskrun>Set the program, script or command that a task runs.
/sc <schedule>Choose the schedule type: minute, hourly, daily, weekly, monthly, once, onstart, onlogon or onidle.
/mo <modifier>Set the recurrence interval or monthly week modifier.
/d <day>, /m <month>Choose schedule days and months where the schedule type supports them.
/st <starttime>, /sd <startdate>Set the start time and start date; date formatting follows the local regional format.
/et <endtime>, /ed <enddate>, /du <duration>Set an end time, end date or maximum duration where supported.
/ri <interval>, /kRepeat at the specified interval; /k stops a task at the configured end boundary.
/i <idletime>Set the idle duration required for an ONIDLE task.
/s <computer>Run the operation against a remote computer.
/u [<domain>\]<user>, /p <password>Supply credentials for remote task operations; /p can expose secrets if placed in shell history.
/ru <username|system>, /rp <password>Choose the account that runs the task and its password; SYSTEM tasks do not use /rp.
/itRun only while the run-as user is logged on; not applicable to SYSTEM tasks.
/npStore no password; the task runs non-interactively with the selected account.
/zDelete the task after its schedule completes.
/xml <xmlfile>Create a task from an XML definition or output task definitions as XML, depending on the operation.
/v1Create a task definition compatible with older Task Scheduler versions.
/fSuppress confirmation prompts where supported.
/rl <level>Set the task run level, such as limited or highest.
/delay <delaytime>Delay an ONSTART task after system startup.
/enable /disableEnable or disable an existing scheduled task.
/fo {TABLE|LIST|CSV}, /nh, /vChoose query output format, omit column headings, or show verbose task details.
/hresultReturn the process exit code in HRESULT format.
/sc <scheduletype>Microsoft documents this switch; use the linked reference for accepted values, effects and version limits.
/?Display command help or the supported command-line usage.
<username>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
<scheduletype>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory