Scheduling tasks in windows command prompt

In earlier versions of windows, “at” command allowed to manage scheduled tasks. But that command is now deprecated. You should use “schtasks” command to manage scheduled tasks. Task scheduler service must be running to use schtasks command.

Creating new scheduled task

Suppose you want to delete the files in a directory every day at 2 PM, then you can create scheduled task as shown in below command.
 

SCHTASKS /Create /SC weekly /D MON,TUE,WED,THU,FRI /ST 14:00 /TN DailyCleanUp  /TR “del /q tempd*”

Here /SC means schedule of the task.
/D means day of the week
/TN means task name
/ST means start time of the task
/TR means task to be run

Creating a one off scheduled task

You can use below syntax to create one off task.
 
SCHTASKS /CREATE /TN “One off task” /TR “del /q tempd*”  /SC ONCE /SD 01/11/2016 /ST 12:00

Deleting the task

 
SCHTASKS /Delete /TN “DailyCleanUp” /

Viewing all scheduled tasks

You can use below command to view all scheduled tasks.
 
SCHTASKS /Query

Web development and Automation testing

solutions delivered!!