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?


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"


  • /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

  • Yes, but when i make this task, the moment i reboot my pc, the task scheduled isn't working anymore – user352156 Dec 10 '14 at 12:56
  • It might be failng because you are not logged in immediately after a reboot. Is there anything in the event logs? Try using the /RU username /RP password options. – DavidPostill Dec 10 '14 at 13:09

You have to use schtasks.exe - is part of the OS. Here are a lot of examples by microsoft. Here is the reference.

  • 1
    The GUI for task administration is started by "taskschd.msc" for Windows 7 Enterprise. It might not be available for all Windows variants. – Axel Kemper Dec 9 '14 at 8:09
  • Isn't he asking for the command line version? – marsh-wiggle Dec 9 '14 at 8:14
  • @boboes No, it's about launching a batch file once every 5 minutes. – Mario Dec 9 '14 at 8:15
  • The GUI is at least helpful to check what you have scheduled by other means. It also shows the available parameters to configure a task. But "schtasks /?" should also be a good start. – Axel Kemper Dec 9 '14 at 8:59

You can try to use the following:

SchTasks /Create /SC MINUTE /MO 5 /SD 12/31/9999 /TN "My Task" /TR %~dp0%~n0%~x0 /ST 23:59:59

as DavidPostill said:

/create - create a new scheduled task
/tn "My Task" - give the task as name
/sc minute - schedule the task with a frequency in minutes
/mo 5 - and modify the frequency to be every 5 minutes
/sd 12/31/9999 - date in which should begin the task mm/dd/yyyy
/st 23:59:59 - start date in which is going to start the task in 24 hour format
/tr "MyTask.cmd" - run the command MyTask.cmd

in my case for "/tr" I used the following:

%~dp0 - path (location) of the current file
%~n0 - current file name
%~x0 - extension of the current file

all information has gotten from the documentation about schtasks, any other command you can check on Windows commands

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.