357

I'm trying to get Windows Task Scheduler to run a particular .exe every 10 minutes or so, but the options only allow for once a day execution.

Is there a way I can get it to run a .exe every 10 or 20 minutes?

Nathan
  • 8,093
  • 8
  • 50
  • 76
kacalapy
  • 9,806
  • 20
  • 74
  • 119
  • 8
    As unintuitive as it is in windows server 2008, you can type a number in the "Repeat task every" dropdown box on the "Edit Trigger" dialog box. I also left a [link](http://social.technet.microsoft.com/Forums/en-US/winserverManagement/thread/74a10148-36c9-432b-be1c-9833d4cbfd86) in MorningZ's entry below. – David Yates Apr 04 '13 at 14:16
  • 4
    Google gives [several](http://www.windowsitpro.com/article/tips/jsi-tip-3121-how-can-i-get-windows-2000-scheduled-tasks-to-repeat-a-task-every-n-minutes-.aspx) [answers](http://www.lonewolfdesigns.co.uk/windows-task-scheduler/), including [this one from Microsoft](http://support.microsoft.com/kb/226795). – Phrogz Jul 12 '13 at 13:11
  • 1
    The problem with links as a comment or answer... All those links from are now broken. I guess its wayback machine time again. – Tim Lovell-Smith Sep 30 '21 at 19:10

8 Answers8

472

The task must be configured in two steps.

First you create a simple task that start at 0:00, every day. Then, you go in Advanced... (or similar depending on the operating system you are on) and select the Repeat every X minutes option for 24 hours.

The key here is to find the advanced properties. If you are using the XP wizard, it will only offer you to launch the advanced dialog once you created the task.

On more recent versions of Windows (7+ I think?):

  1. Double click the task and a property window will show up.
  2. Click the Triggers tab.
  3. Double click the trigger details and the Edit Trigger window will show up.
  4. Under Advanced settings panel, tick Repeat task every xxx minutes, and set Indefinitely if you need.
  5. Finally, click ok.
Stevoisiak
  • 23,794
  • 27
  • 122
  • 225
Coincoin
  • 27,880
  • 7
  • 55
  • 76
  • 57
    The problem with this solution is that if you reboot at 0:05, the task will not begin to repeat until 23:55 later! – JoshuaDavid Nov 03 '11 at 23:35
  • 9
    A slight variation, would be to set 24 tasks, each repeat for 1 hour. Then you never lose more than an hour of coverage – Yablargo Dec 27 '11 at 20:28
  • 129
    @FireCoding not if you have set the task to run as soon as a scheduled start is missed. Under Task > Properties > Settings > Check `Run task as soon as possible after a scheduled start is missed` – Urda Feb 27 '12 at 20:56
  • 7
    @Urda: Say you set the task to start at 0:00, and to repeat every hour. If you power on the computer at 06:00, and the option `Run task as soon as possible after...` is on, will it run one or six instances of the command? – Andreas Rejbrand Feb 03 '13 at 15:15
  • 9
    @AndreasRejbrand `If this setting is checked, the Task Scheduler service will start the task if the task was scheduled to run at a certain time, but for some reason (for example, the computer was turned off or the Task Scheduler service was busy) the task was not activated. The Task Scheduler service will not start the task immediately after the task was missed. By default the service waits ten minutes before starting the missed task.` So it should just start 1 instance of the task, not the entire backlog. – Urda Feb 03 '13 at 16:54
  • For Windows 8/8.1 go to Triggers->Edit(bottom middle)-> Repeat Task Every X minutes – JqueryToAddNumbers Dec 10 '14 at 04:45
  • This wasn't relevant on Server 2012. Durim Sinani's answer worked there: just type the value you want into the 'repeat every' box. – decates Jul 30 '15 at 11:01
  • 1
    My problem with this is that it says "Running" all day. I wish it could literally just run every hour. Is there a registry entry or anything? –  Sep 15 '15 at 15:22
  • 4
    I had an issue that it would not start running again after a reboot until the trigger kicked in again. Realized that you can use "At system startup" as the trigger and "Indefinitely" for the repeat timeframe. I think that should work. – Truisms Hounds Aug 05 '16 at 20:25
  • @JoshuaDavid it seems you are wrong. I created task in Win Server 2008 R2 as described in this answer and it runs automaticaly each minute also after reboot without checking `Run task as soon as possible after a scheduled start is missed` as @Urda commented. – mikep Jan 31 '18 at 14:45
  • 1
    It is absolutely only Microsoft who can make such an unintelligent interface - it's so weird how they can NEVER figure out how to design systems properly..! It just boggles my mind - like they on purpose make things difficult! – TheStoryCoder Oct 01 '20 at 20:07
61

After you select the minimum repeat option (5 minutes or 10 minutes) you can highlight the number and write whatever number you want

Durim Sinani
  • 611
  • 5
  • 2
  • This is what works on Server 2012 as there is no 'Advanced' option. The key on these platforms is to realise that you can specify whatever you like in the box. – decates Jul 30 '15 at 11:00
  • 17
    far out... 0 out of 10 for discoverability in UI design Microsoft! – Damien Sawyer Oct 23 '16 at 20:58
  • good to know, very good to know :) But there is no further possibility to go down to seconds, is there? 1 minute is the least? I'd like to go to 30 or even 10 secs... – BAERUS Jan 10 '18 at 18:53
  • 1
    This is a comment, not an answer. – Léo Natan Sep 02 '18 at 16:59
  • 7
    @LeoNatan Actually this was the exact answer I was looking for when I strolled into this post :-) – Jony Adamit Nov 21 '18 at 10:34
  • How did you find about this "trick" I don't know but it sure works! Thank you! –  Feb 18 '20 at 17:48
53

You can also create a batch file like the following if you need finer granularity between calls:

:loop
call YourScript.Exe
timeout /t timeToWaitBetweenCallsInSeconds /nobreak
goto :loop
Gulzar
  • 23,452
  • 27
  • 113
  • 201
Kevin Lee
  • 1,370
  • 14
  • 22
  • 3
    In my case that was the most elegant solution as the task in question was already started from a batch file. So it was just a matter of adding a couple of lines. Thanks! – marlar Feb 16 '16 at 19:03
  • 3
    I like this solution. But how do you ensure this batch file is always running (and only one instance of it)? – Olivier 'Ölbaum' Scherler Jan 27 '17 at 09:37
  • 1
    This is a way to do it yes, but Task scheduler is the way to go. Just use the "After startup" option instead of a specific date, and you're covered. – Jakob Sternberg May 04 '17 at 19:46
  • I have all sort of issues configuring a task to run every hour. So, I like this solution to loop it and let it sleep for 1 hour and loop the job. Just need to figure out how the timing works with daily job and whether the hourly tasks causes an issue every 24 hours. – Sun Mar 04 '20 at 17:03
  • @Olivier'Ölbaum'Scherler have you found any solution to check if the batch file is always running? – Mahadev Mandale Dec 24 '21 at 12:32
52

Hourly task example

While taking the advice above with schtasks, you can see in the UI what must be done to perform an hourly task. When you edit trigger begin the task on a schedule, One Time (this is the key). Then you can select "Repeat task every:" 1 hour or whatever you wish. See screenshot:

Mike Cush
  • 611
  • 6
  • 2
  • 3
    And using `SCHTASKS /Create` ? – Kiquenet Oct 02 '18 at 13:24
  • Not only that the menu itself so user-unfriendly also the translation into german ist very misleading. Instead of "indefinitely" in german there is shown the word for "immediately" which makes no sense in that context at all. – tollube Aug 16 '22 at 06:05
  • Won't be a good time on restart, I recommend that you do daily and for the duration of 1 day. – Jordan Casey Jan 27 '23 at 17:01
29

In the "Repeat Task every:" just type 2 minutes instead of choosing from the dropdown list.

Henrik
  • 291
  • 3
  • 2
23

On XP, I clicked the Advanced button on the Schedule tab. There is a checkbox for Repeat task. The default is every 10 minutes.

Additionally, you can create scheduled task via the command line. I haven't tried this myself, but it looks like you'd want something along the lines of (not tested):

schtasks /create /tn "Some task name" /tr "app.exe" /sc HOURLY 
Courtney Christensen
  • 9,165
  • 5
  • 47
  • 56
  • im confused about the until options. i set it to repeat every 5 minutes lets say, then im forced to chose a radio button under that... what do i enter if i want ti to run every 5 minutes every day and not stop. – kacalapy Nov 22 '10 at 20:16
  • Ok, you're right. That is confusing. Apparently you can create one via the command line. Maybe that's worth a shot. I've updated the post with the link I found. – Courtney Christensen Nov 22 '10 at 21:50
8

To schedule the update to be automatic you should:

  • Go to Control Panel » Administrative Tools » Scheduled Tasks
  • Create the (basic) task
  • Go to Schedule » Advanced
  • Check the box for "Repeat Task" every 10 minutes with a duration of, e.g. 24 hours or Indefinitely
  • Leave End Date unchecked

If you cannot find the Schedule settings, look under: Properties, Edit, Triggers.

Roland
  • 4,619
  • 7
  • 49
  • 81
David
  • 2,987
  • 1
  • 29
  • 35
3

Some of the links provided are only settings for Windows 2003's version of "Scheduled Tasks"

In Windows Server 2008 the "Tasks" setup only has a box with options for "5 Minutes, 10 minutes, 15 minutes, 30 mins, and 1 hour" (screen shot: http://i46.tinypic.com/2gwx7r8.jpg)... where the Window 2003 was a "enter whatever number you want" textbox.

I thought doing an "Export" and editing the XML from: PT30M to PT2M

and importing that as a new task would "trick" Tasks into repeating every 2 mins, but it didn't like that

My workaround for getting a task to run every 2 mins in Windows 2008 was to (ugggh) setup 30 different "triggers" for my task repeating every hour but staring at :00, :02, :04, :06 and so on and so on.... took me 8-10 mins to setup but I only had to do it once :-)

MorningZ
  • 39
  • 5
  • 18
    As unintuitive as it is, you can actually type a number in the Windows server 2008 dropdown: http://social.technet.microsoft.com/Forums/en-US/winserverManagement/thread/74a10148-36c9-432b-be1c-9833d4cbfd86 – David Yates Apr 04 '13 at 14:09
  • 1
    Oh wow @DavidYates you were right! Even Windows Server 2016 this is still a thing. You wouldn't think you can just type a number and a granularity into a dropdown but it turns out you can. – Marl Xtian Monzon Marcera Apr 21 '22 at 09:04