Use SchTasks.exe to Create and Manage Tasks

 

The Schtasks.exe command-line interface utility allows an administrator to create, delete, query, change, run, and end scheduled tasks on a local or remote system through the command shell. Here’s an overview of its syntax and parameters. 

Command Syntax 

The SchTasks.exe command interface uses the following syntax: 
SCHTASKS /<parameter> [arguments] 

Command Parameters
The available parameters for SchTasks.exe are as follows: 

  • /Create Creates a new scheduled task
  • /Delete Deletes the scheduled task(s)
  • /Query Displays all scheduled tasks
  • /Change Changes the properties of the scheduled task
  • /Run Runs the scheduled task immediately
  • /End Stops the currently running scheduled task
  • /? Displays a help message



Creating Tasks 
The general syntax for Schtasks.exe is as follows: 
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] [/Z] [/F] 

The following is an example command: 
SCHTASKS /Create /S system /U user /P password /RU runasuser /RP runaspassword /SC HOURLY /TN rtest1 /TR notepad 

Deleting Tasks
The general syntax for deleting a task is as follows: 
SCHTASKS /Delete [/S <system> [/U <username> [/P [<password>]]]] /TN <taskname> [/F] 

The following is an example command: 
SCHTASKS /Delete /TN "Backup and Restore” 

Running Tasks
The general syntax for running a task is as follows: 
SCHTASKS /Run [/S <system> [/U <username> [/P [<password>]]]] /TN <taskname> 

The following is an example command: 
SCHTASKS /Run /TN "Start Backup" 

Ending Tasks
The general syntax for ending a task is as follows: 
SCHTASKS /End [/S <system> [/U <username> [/P [<password>]]]] /TN <taskname> 

The following is an example command: 
SCHTASKS /End /TN "Start Backup" 

Querying Tasks
The general syntax for querying a task is as follows: 
SCHTASKS /Query [/S <system> [/U <username> [/P [<password>]]]] [/FO <format>] [/NH] [/V] [/?] 

The following is an example command: 
SCHTASKS /Query /S system /U user /P password SCHTASKS /Query /FO LIST /V 

Changing Tasks
The general syntax for changing a task is as follows: 
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] } 

The following is an example command: 
SCHTASKS /Change /RP password /TN "Backup and Restore" 

Read 212 times
KT_Austin

About:

I love my computer because all my friends live inside it

Welcome to AustinLaptop.Com

Top
We use cookies to improve our website. By continuing to use this website, you are giving consent to cookies being used. More details…