user1016945
user1016945

Reputation: 897

Run Task Immediately Microsoft.Win32.TaskScheduler

I'm using Task Scheduler Managed Wrapper from Codeplex and I need to fire task as soon as possible and only once. I don't found any API that could execute created task immediately (I can be wrong). So how can I create a trigger that fires only once and as soon as possible?

Upvotes: 1

Views: 3977

Answers (1)

user1016945
user1016945

Reputation: 897

Found solution here.

using (TaskService ts = new TaskService())
{
   string task = "TaskName";
   // This will find it even if its down in a folder. Alternately you could call:
   // Task t = ts.GetTask(task);
   Task t = ts.FindTask(task);
   if (t != null)
      t.Run();
}

Upvotes: 5

Related Questions