我有以下代码每 1 分钟打开记事本。但它不起作用。有人可以建议我答案吗?
using (TaskService ts = new TaskService())
{
TaskDefinition td = ts.NewTask();
td.RegistrationInfo.Description = "My first task scheduler";
TimeTrigger trigger = new TimeTrigger();
trigger.StartBoundary = DateTime.Now;
trigger.Repetition.Interval = TimeSpan.FromMinutes(1);
td.Triggers.Add(trigger);
td.Actions.Add(new ExecAction(@"D:\Tasks\sample.exe", null, null));
ts.RootFolder.RegisterTaskDefinition("TaskName", td);
}