Windows scheduler that runs every x minutes daily on the command line

cmd.execommand linescheduled-taskswindowswindows task scheduler

Is there a way to schedule a task (.bat) through the command line that runs every five minutes daily?

I also want it to run even if the user isn't logged on. What is the exact command line syntax?

Best Answer

Is there a way to schedule a task that runs every 5 minutes daily?

You can do this with the following command:

schtasks /create /tn "MyTask" /sc minute /mo 5 /tr "MyTask.cmd"

Explanation:

  • /create - create a new scheduled task
  • /tn "MyTask" - give the task as name
  • /sc minute - schedule the task with a frequency in minutes
  • /mo 5 - and modify the freqency to be every 5 minutes
  • /tr "MyTask.cmd" - run the command MyTask.cmd

Source schtasks - Create / edit a Scheduled Job/Task.


Further Reading

Related Question