schtasks: Enables an administrator to create, delete, query, change, run and end scheduled tasks on a local or remote system. Replaces AT. ...
The command: "schtasks" is on Windows 11, 10, .. available
"schtasks" Excerpt from Microsoft Windows Help
Microsoft Windows [Version 10.0.19045.3693]
(c) Copyright 1985-2023 Microsoft Corp.
C:\\WINDOWS>
SCHTASKS /parameter [arguments]
Description:
Enables an administrator to create, delete, query, change, run and
end scheduled tasks on a local or remote system. Replaces AT.exe.
Parameter List:
/Create Creates a new scheduled task.
/Delete Deletes the scheduled task(s).
/Query Displays all scheduled tasks.
/Change Changes the properties of scheduled task.
/Run Runs the scheduled task immediately.
/End Stops the currently running scheduled task.
/? Displays this help/usage.
Examples:
SCHTASKS
SCHTASKS /?
SCHTASKS /Run /?
SCHTASKS /End /?
SCHTASKS /Create /?
SCHTASKS /Delete /?
SCHTASKS /Query /?
SCHTASKS /Change /?
The examples for the command "schtasks"
The
`schtasks` command in Windows is used to create, configure or view scheduled tasks. Here are some examples of using the
`schtasks` command:
### View scheduled tasks:
Example 1: View all scheduled tasks:
schtasks /query /fo list /v
This command displays all scheduled tasks on the current computer, including detailed information.
Example 2: View a specific scheduled task:
schtasks /query /tn "TaskName" /fo list /v
Replace
"TaskName" with the name of the specific scheduled task you want to display.
Example 3: Creating a Scheduled Task for a Batch Script:
schtasks /create /tn "MyTask" /tr "C:\Path\To\Script.bat" /sc daily /st 12:00
This command creates a scheduled task named MyTask that runs a batch script every day at 12:00 p.m.
Example 4: Creating a scheduled task with specific permissions:
schtasks /create /tn "MyTask" /tr "C:\Path\To\Script.bat" /sc daily /st 12:00 /ru "Username" /rp "Password"
Here the scheduled task is created with specific credentials (
`username` and
`password`).
Example 5: Changing the start time of a scheduled task:
schtasks /change /tn "MyTask" /st 14:00
This command changes the start time of the scheduled task named MyTask to 2:00 p.m.
Example 6: Deleting a scheduled task:
schtasks /delete /tn "MyTask" /f
This command deletes the scheduled task named MyTask. The
`/f` option prevents a query.
These examples should give you an idea of ??how the
`schtasks` command can be used in different scenarios. Depending on your specific requirements, the parameters may vary. Use
`schtasks/?` for a complete list of options and parameters. Also note that creating and modifying scheduled tasks requires administrator rights.
Important information, tips for the "schtasks" command
There are some important considerations and points to note when using the `schtasks` command in Windows:
---- Security and Permissions:
1. Admin Privileges: Most `schtasks` operations require administrator privileges. Therefore, run the commands in an elevated command prompt (as an administrator).
2. Scheduled task permissions: Make sure that the user running `schtasks` has the required permissions for the scheduled tasks. Especially when creating or modifying tasks with specific credentials (`/ru` and `/rp`), the credentials should have sufficient permissions.
3. Time Format: Make sure the times and schedules are formatted correctly. Incorrect time specifications can lead to unexpected behavior.
4. Time vs. Time Interval: Note the difference between specifying a specific time (`/st`) and a time interval (`/ri`). Clarify what type of schedule is appropriate for your planned task.
---- Command parameters:
5. Parameter combinations: Some parameters are related to each other. Make sure the combination of parameters makes sense and produces the desired results.
6. Understanding the parameters: Take the time to read the documentation (`schtasks/?`) to understand the various parameters and their implications.
---- Logging:
7. Task logging: Check the logs of your scheduled tasks to ensure they are running properly. This can be helpful in identifying problems.
---- Special task types:
8. Program or script dependencies: If your scheduled task depends on external programs or scripts, ensure that the environment variables, paths and dependencies are configured properly.
---- Monitoring and Maintenance:
9. Periodic Check: Regularly check your scheduled tasks, especially after system updates or changes, to ensure they are working properly.
10. Backup of Tasks: If necessary, create backups of your scheduled task configuration for quick restore in the event of a problem.
It is important to use the `schtasks` commands carefully, especially when used on production systems. Unwanted changes to scheduled tasks can result in unexpected behavior.