batch job every 5 minutes

jamesmetcalf74 used Ask the Experts™
how can i schedule a batch job to run every 5 minutes without having to schedule it every five minutes in task scheduler?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Create the job and set it to run daily.  After you create the "at" command or create the job in scheduler you can then go back into the job and go to advanced and select it to run X minutes and such.
Bill PrewIT / Software Engineering Consultant
Top Expert 2016
You should be able to add it from the command line, something like:

schtasks.exe /Create /TN "My Task" /TR "C:\Test.bat" /RU System /SC Minute /MO 5

you can do schtasks /? to see all the options.

Or, if you want to use the Task Scheduler GUI tool, then follow the steps here:

Or just run the batch and have it loop at the end having delayed for approx. 5 minutes (or say 4 minutes if it always takes 1 minute).  You could also wait for the next increment of 5 minutes say from the current time:

@echo off
call :yourstuff
ping -n 300 >NUL
goto :loop
exit /b

  echo This will run each 5 mins.  Now is %time%
exit /b

Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Disadvantage of this way: If you close the batch window you've lost our scheduled jobs.  Could get around this with a periodic check if the task is running and restart if not.
Advantage: You won't get an over-running earlier job interfering or clashing with a later running one
Lionel MMSmall Business IT Consultant
Just go to schedule tasks and under the option choose to run it every 5 minutes
Lionel MMSmall Business IT Consultant
Windows XP--Control Panel then Scheduled Tasks. Setup the task.
Then click on the Schedule tab, look for the Advanced button next to the time--click on it on the check the "Repeat Task" and choose the time (5) and then select Minutes from the drop down (minutes or hours).


thanks guys

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial