如何将DaysInterval更改为12小时或更长时间而不是几天。 在这段代码中:
using (TaskService ts = new TaskService())
{
// Create a new task definition and assign properties
TaskDefinition td = ts.NewTask();
td.RegistrationInfo.Description = "Does something";
// Create a trigger that will fire the task at this time every other day
td.Triggers.Add(new DailyTrigger { DaysInterval = 1 });
// Create an action that will launch Notepad whenever the trigger fires
td.Actions.Add(new ExecAction("notepad.exe", "c:\\test.log", null));
// Register the task in the root folder
ts.RootFolder.RegisterTaskDefinition(@"Test", td);
// Remove the task we just created
ts.RootFolder.DeleteTask("Test");
}
答案 0 :(得分:1)
您是否检查过TaskScheduler Codeplex网站?
触发器有详细解释
http://taskscheduler.codeplex.com/wikipage?title=TriggerSamples&referringTitle=Documentation