The Task Scheduler enables you to automatically perform routine tasks on a chosen computer. Task Scheduler does this by monitoring whatever criteria you choose (referred to as triggers) and then executing the tasks when those criteria are met. You can use the Task Scheduler to execute tasks such as starting an application, sending an email message, or showing a message box. Tasks can be scheduled to execute in response to these events, or triggers. Kind refer to these related guides: How to create advanced scheduled task on Windows Server with Windows Task Scheduler, how to create a Scheduled task with Windows Admin Center, how to setup Windows server backup and create backup jobs, and how to create Windows Task Scheduler via the command prompt.
Task Scheduler allows you to automate many tasks on Windows 10, 11 a,d on Windows Servers. The Task Scheduler was formerly refferd to as "Scheduled Tasks". Here is a link to all articles relating to task scheduler.
Windows Server and Windows 10 by default have the Task Scheduler and this enables you to run tasks automatically as a scheduled time. Task schedulers can be used to launch applications, word documents, execute scripts at a scheduled time.
The command prompt can be used to create, edit and delete a scheduled task and below are some flags associated with the executable
Task Scheduler creates options via Command-line: Here are the options allowing to create and customize a scheduled task via the command-line.
|/CREATE||Specifies that you want to create a new an automated routine.|
|/SC||Defines the schedule for the task. Options available, include MINUTE, HOURLY, DAILY, WEEKLY, MONTHLY, ONCE, ONSTART, ONLOGON, ONIDLE, and ONEVENT.|
|/D||specifies the day of the week to execute the task. Options available, include MON, TUE, WED, THU, FRI, SAT, and SUN. If you’re using the MONTHLY option, then you can use 1 – 31 for the days of the month. Also, there’s the wildcard “*” that specifies all day.|
|/TN||Specifies the task name and location. The “MyTasks\Notepad task” uses the “Notepad task” as the name and stores the task in the “MyTasks” folder. If the folder isn’t available, it’ll be created automatically.|
|/TR||Specifies the location and the name of the task that you want to run. You can select an app or a custom script.|
|/ST||Defines the time to run the task (in 24 hours format).|
|/QUERY||Displays all the system tasks.|
|/RU||Specifies the task to run under a specific user account.|
Create Scheduled Task: Below are the space to create a scheduled task via the command prompt. Launch the Command Prompt with the Administrator’s right. Below is the command and please modify it to your desired need
Daily: Type the following command to create a daily task
SCHTASKS /CREATE /SC DAILY /TN "FOLDERPATH\TASKNAME" /TR "C:\SOURCE\FOLDER\APP-OR-SCRIPT" /ST HH:MM
Weekly: Type the following command to create a weekly task
SCHTASKS /CREATE /SC WEEKLY /D SUN /TN "FOLDERPATH\TASKNAME" /TR "C:\SOURCE\FOLDER\APP-OR-SCRIPT" /ST HH:MM
Monthly: Type the following command to create a monthly task.
SCHTASKS /CREATE /SC MONTHLY /D 15 /TN "FOLDERPATH\TASKNAME" /TR "C:\SOURCE\FOLDER\APP-OR-SCRIPT" /ST HH:MM
To modify (edit) the Task Scheduler option via the Command: In this guide, we are using the following options to create a scheduled task:
|/CHANGE||Specifies that you want to edit an existing task|
|/TN||Specifies the name and location of the task that you want to modify|
|/ST||Defines the new time to run the automated routine.|
These are just some of the available options. You can learn more about the options to change a scheduled task running the SCHTASKS /CHANGE /? command.
To delete a scheduled task: Here are some commands associated with the command prompt to delete a scheduled task.
|/DELETE||Specifies that you want to delete an existing task.|
|/TN||Specifies the name and location of the task that you want to delete|
This was tested on Windows 10 and Windows Server 2019. If you need any further assistance, please let me know.