The schtasks command enables an administrator to create, delete, query, change, run, and end scheduled tasks on a local or remote system.

Availability

Schtasks is an external command that is available for the following Microsoft operating systems as schtasks.exe.

  • Availability

  • Schtasks syntax

  • Schtasks examples

  • Windows Vista

  • Windows 7

  • Windows 8

  • Windows 10

  • Windows 11

Schtasks syntax

SCHTASKS /parameter [arguments]

SCHTASKS /Create [/S system [/U username [/P [password]]]] [/RU username [/RP password]] /SC schedule [/MO modifier] [/D day] [/M months] [/I idletime] /TN taskname /TR taskrun [/ST starttime] [/RI interval] [ {/ET endtime | /DU duration} [/K] [/XML xmlfile] [/V1]] [/SD startdate] [/ED enddate] [/IT | /NP] [/Z] [/F] [/HRESULT] [/?]

Create modifiers

Valid values for the /MO switch per schedule type:

MINUTE: 1 - 1439 minutes. HOURLY: 1 - 23 hours. DAILY: 1 - 365 days. WEEKLY: weeks 1 - 52. ONCE: No modifiers. ONSTART: No modifiers. ONLOGON: No modifiers. ONIDLE: No modifiers. ONTHLY: 1 - 12, or FIRST, SECOND, THIRD, FOURTH, LAST, LASTDAY. ONEVENT: XPath event query string.

Jump to examples including schtasks delete examples.

SCHTASKS /Delete [/S system [/U username [/P [password]]]] /TN taskname [/F] [/HRESULT] [/?]

SCHTASKS /Query [/S system [/U username [/P [password]]]] [/FO format | /XML [xml_type]] [/NH] [/V] [/TN taskname] [/HRESULT] [/?]

Jump to examples including schtasks query examples.

SCHTASKS /Change [/S system [/U username [/P [password]]]] /TN taskname { [/RU runasuser] [/RP runaspassword] [/TR taskrun] [/ST starttime] [/RI interval] [ {/ET endtime | /DU duration} [/K] ] [/SD startdate] [/ED enddate] [/ENABLE | /DISABLE] [/IT] [/Z] } [/HRESULT] [/?]

Jump to examples including schtasks change examples.

SCHTASKS /Run [/S system [/U username [/P [password]]]] [/I] /TN taskname [/HRESULT] [/?]

Jump to examples including schtasks run examples.

SCHTASKS /End [/S system [/U username [/P [password]]]] /TN taskname [/HRESULT] [/?]

Jump to examples including schtasks end examples.

SCHTASKS /ShowSid /TN taskname [/HRESULT] [/?]

Schtasks examples

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 CSV format.

Schtasks change example

SCHTASKS /Change /TR restore.exe /TN “\Backup\Start Restore”

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.

  • How to get to an MS-DOS prompt or Windows command line.