Home > Commands N-Z > Commands S

SCHTASKS


Description | Syntax | Parameters | Switches | Related | Notes | Examples | Errorlevels | Availability

Schedules commands and programs to run periodically or at a specific time. Adds and removes tasks from the schedule, starts and stops tasks on demand, and displays and changes scheduled tasks.


Syntax

SCHTASKS /?

SCHTASKS {/CHANGE | /CREATE | /DELETE | /END | /QUERY} | /RUN} /?

SCHTASKS /CHANGE /TN task_name [/S computer [/U [domain\]user /P password]] [/TR task_run] [/RU {[domain\]user | "System"} /RP password]]

SCHTASKS /CREATE /TN task_name /TR task_run /SC schedule [/MO modifier] [/D day] [/M month[,month ...]] [/I idle_time] [/ST start_time] [/SD start_date] [/ED end_date] [/S computer [/U [domain\]user /P password]] [/RU {[domain\]user | "System"} /RP password]]

SCHTASKS /DELETE /TN task_name [/F] [/S computer [/U [domain\]user /P password]]

SCHTASKS {/END | /RUN} /TN task_name [/S computer [/U [domain\]user /P password]]

SCHTASKS [/QUERY] [/FO format] [/NH] [/V] [/S computer [/U [domain\]user /P password]]


Parameters

none.


Switches
/? (NTXP)
Displays help.
/CHANGE (NTXP)
Changes one or more properties of a task.
/CREATE (NTXP)
Creates a new scheduled task.
/D day (NTXP)
Specifies a day of the week or a day of a month. Valid only with a WEEKLY or MONTHLY schedule:
/DELETE (NTXP)
Deletes a scheduled task.
/ED start_date (NTXP)
Specifies the last date that the task is scheduled to run. This switch is optional. It is valid with MINUTE, HOURLY, DAILY, WEEKLY, and MONTHLY schedules. By default, schedules have no ending date.
/END (NTXP)
Stops a program started by a task.
/F (NTXP)
Suppresses the confirmation message. The task is deleted without warning.
/FO format (NTXP)
Specifies the output format:
/I idle_time (NTXP)
Specifies how many minutes the computer is idle before the task starts. Type a whole number from 1 to 999. Required and valid only with an ONIDLE schedule.
/M month[, month ...] (NTXP)
Specifies a month of the year. Valid values are JAN - DEC and * (every month). Valid only with a MONTHLY schedule. required when LASTDAY is used. Otherwise, it is optional and the default value is * (every month).
/MO modifier (NTXP)
Specifies how often the task runs within its schedule type. Required for MONTHLY schedule. Optional for MINUTE, HOURLY, DAILY, or WEEKLY schedule. The default value is 1:
      Type    Modifier  Description
      MINUTE  1 - 1439  The task runs every n minutes.
      HOURLY  1 - 23    The task runs every n hours.
      DAILY   1 - 365   The task runs every n days.
      WEEKLY  1 - 52    The task runs every n weeks.

      MONTHLY 1 - 12    The task runs every n months.
              LASTDAY   The task runs on the last day of the month.
              FIRST
              SECOND
              THIRD
              FOURTH
              LAST      Use with /d day
                        to run a task on a particular week and day.
      Type    Modifier  Description
/NH (NTXP)
Omits column headings from the table display. Valid with the TABLE and CSV output formats.
/P password (NTXP)
Specifies the password of the /u user account.
/QUERY (NTXP)
Displays all tasks scheduled to run on the computer, including those scheduled by other users.
/RP password (NTXP)
Specifies the password of the /ru user account. If you omit this switch when specifying a user account, you will be prompted for the password unless the NT Authority\System permissions does not require a password.
/RU {[domain\]user | "System"} (NTXP)
Runs the tasks with the permission of the specified user account. By default, the task runs with the permissions of the user logged on to the computer.
      Value           Description
      [Domain\]User   Specifies a user account.
      "System" or ""  Specifies the NT Authority\System account,
                      which is used by the operating system.
/RUN (NTXP)
Starts a scheduled task immediately. Ignores the schedule, but uses the program file location, user account, and password saved in the task to run the task immediately.
/S computer (NTXP)
Specifies the name or IP address of a remote computer (with or without backslashes). The default is the local computer.
/SC schedule (NTXP)
Specifies the schedule type. Valid values are:
/SD start_date (NTXP)
Specifies the date that the task starts in MM/DD/YYYY format. The default value is current date. Valid with all schedules, and Required for ONCE schedule.
/ST start_time (NTXP)
Specifies the time of day that the task starts in HH:MM:SS 24-hour format. The default value is current local time when the command completes. Valid with MINUTE, HOURLY, DAILY, WEEKLY, MONTHLY, and ONCE schedules. Required with a ONCE schedule.
/TN task_name (NTXP)
Specifies a name for the task.
Task_name of * can /DELETE ALL scheduled tasks on the computer.
/TR task_run (NTXP)
Specifies the program or command that the task runs. Type the fully qualified path and file name of an executable file, script file, or batch file. If you omit the path, the file is assumed to be in the Systemroot\System32 directory.
/U [domain\]user (NTXP)
Runs the command with the permissions of the specified user account. By default, the command runs with the permissions of the user logged on to the computer.
/V (NTXP)
Adds advanced properties of the tasks to the display. QUERIES should be formatted as LIST or CSV.

Related

none.


Notes

none.


Examples

none.


Errorlevels

none.


Availability
External
DOS
none
Windows
none
Windows NT
NTXP NT2003