Reputation: 987
I'd like to run a Powershell script every two minutes, but either with manual start and stop OR tie it into starting and stopping when a specific application starts and stops.
I'm new to task scheduler and managed to get a task created, but could only find an "every five minutes option", and only by creating a trigger and looking at advanced options in there (and there doesn't seem to be a manual start / stop trigger).
If I then manually start the task, it runs correctly a single time, states five minutes in the future as the next run time, but doesn't actually execute at that time (status becomes "ready" after that initial manual run).
I'm certainly not opposed to considering alternatives to Windows task scheduler if there's a better option.
Upvotes: 1
Views: 6322
Reputation: 81
consider something like
schtasks /create /sc minute /MO 2 /tn "Example\Test" /tr "C:\path\file.exe" /st 10:50
schtasks /delete /tn "Example\Test"
Upvotes: 0
Reputation: 554
Sidenote: The "Last Run Result" contains helpful debugging information. It doesn't update automatically, you have to hit the "Refresh" button on the right side for that.
From now on, you can enable/disable this task manually in the task scheduler. You could add another task that triggers when the process of your "other" application is running, which then enables/disables this task. Just meant as a hint though.
Upvotes: 1