20

I am trying to set up a task that will start up an .exe every minute.

I have created a Trigger, that when triggered will run the .exe and repeat every minute indefinitely. (I have also tried creating a daily task, the once triggered will repeat every minute for that 1 day).

When I run the task manually, it works as expected, but if I leave the task to reach the 'Next Run Time' instead of it running and updating the 'Last Run Time', the 'Next Run Time' is updated to run a minute later and the 'Last Run Time' remains the same.

I have checked the Task History and there are no new events. Also, I have logging within the specified .exe and it's not showing that it has been run.

Overview

Edit Details

Settings

Settings

Jack Allen
  • 301
  • 1
  • 2
  • 3
  • Check the event viewer in case it is crashing. It could be running in the background, so you do not start a new instance? Check Task Manager to make sure the exe isn't running – Dave Jan 15 '15 at 12:08
  • @Dave It doesn't appear to be running in the background and I can't see any logs in the Event Viewer for the Task Scheduler. Do you know if the .exe has to be in a specific location or something like that? – Jack Allen Jan 15 '15 at 14:14
  • No, the .exe can be any where. However, the exe could be crashing or similar so I thought to check event viewer. What is the application? One you wrote or 'other'? – Dave Jan 15 '15 at 14:17
  • The .exe is something I have written, although I have run it both on the server from its directory location and also I have manually run the Task in the Scheduler and the .exe runs successfully. – Jack Allen Jan 15 '15 at 14:20
  • Does this issue occur when you're logged onto the server? – Dave Jan 15 '15 at 14:21
  • @Dave also to confirm that it is not my .exe causing it. I set the Task action to display a dialog message and it acted the same way. – Jack Allen Jan 15 '15 at 14:22
  • Please create a new task in task scheduler, which opens notepad every minute. – Dave Jan 15 '15 at 14:23
  • @Dave Yes, I am logged onto the server during the testing – Jack Allen Jan 15 '15 at 14:23
  • @Dave I have tried your suggestion. Unfortunately, it will not do this, I have both created a BATCH file that opens notepad and linked to the full path of the Notepad.exe and neither have worked. – Jack Allen Jan 15 '15 at 14:41
  • ... what does that mean, they don't work? Are you saying you can't load notepad via a batch file? If so, sounds like a permissions issue. – Dave Jan 15 '15 at 14:50

5 Answers5

19

Just in case you trigger the task manually...

I have just come across this same problem on Window 7. I haven't tested it with any other version of Windows.

It seems that repeated tasks are not executed when run manually (right click on a task and then select "Run").

When run manually, the task will run only once and that's it!

This is a trip wire since it's natural that people simply run the task manually right after its creation to check whether it's working as expected.

What you could do, set the trigger to "At startup". After you rebooted the machine, the task should then be in the "Queued" status. This means it will run at the configured interval.

quat
  • 371
  • 1
  • 3
  • 8
  • A better solution via @user917170 is to check _'Run task as soon as possible after a scheduled start is missed'_ with whatever trigger you want (time based, etc). Then it should start running automatically on schedule as expected. – drzaus Feb 11 '19 at 13:58
  • This is not correct. Repeated tasks work well even on a manual start if the start date and time of the Trigger is set prior to the manual start date and time. See answer of `IdontCareAboutReputationPoints`. Even the prior suggestion does not start the series otherwise. – sdittmar Jun 26 '20 at 07:41
  • @sdittmar This is not incorrect. It's a different way of addressing the problem. – quat Jun 29 '20 at 22:09
3

I ran into this problem me too, I was able to solve it by setting the start date and time one or two minutes ahead of the time of making the task to trigger the action and start repeating it as configured.

  • This here is the correct answer when using a manual start. The repeat series will only trigger when the start date/time of the Trigger is set prior to the manual start - which makes sense, doesn't it? When you set up a new task you often use a date in the future. That is why I also run into the same problem as the OP. This answer solved it. – sdittmar Jun 26 '20 at 07:37
3

The correct way to set this up is to set the start time any time in the past, then select "Run task as soon as possible after a scheduled start is missed" in the Settings tab.

user917170
  • 131
  • 2
2

Manual triggering is for testing. You need a real trigger to start repetition.

I solved this by setting up a trigger for system start, as suggested, but if that session fails or you make edits, and you don't want to restart the machine, just set an additional trigger to perform the same sort of repetition on a daily basis, with a start time in a minute or two.

You can then leave both triggers running, and set them both to not start another instance if one is already running, with appropriate timeouts to kill the current instance if it runs too long. This way, you are assured of triggering, even if the instance that started when the computer was last rebooted dies.

music2myear
  • 38,549
  • 35
  • 77
  • 123
  • Creative solution. I am going to give this a try. – Rod Hartzell Aug 07 '17 at 15:47
  • Better: enable 'run as soon as scheduled start missed'. In general, be wary of multiple triggers for two reasons -- exporting a task w/ an end-date on a trigger, importing won't respect the end date and both will be active. Also, there was a hotfix for some Windows ([KB2461249|https://support.microsoft.com/en-us/help/2461249/the-task-scheduler-service-runs-the-same-job-two-times-in-windows-serv]) because the scheduler would double-schedule a task if the start time coincided with the end of a window, so I could imagine some weird rounding causing multiple overlapping triggers to fire. – drzaus Feb 11 '19 at 14:09
1

I just ran into this problem while trying to migrate scheduled tasks from my home PC (Windows 10 Pro) to a server (also running Windows 10 Pro, freshly installed via Microsoft's media creation tool). The migrated tasks simply would not repeat. What ended up working for me was changing the Trigger from 'Daily" to "One time".

Screenshot

jaydeel
  • 11
  • 2