我创建了一个任务计划程序并将其触发时间设置为固定,例如每天下午 5:00,但我想在系统启动或引导时触发该事件。如果您有任何示例,请帮助我提供代码。
提前致谢。
代码 : - - - - - - - - - - - - - - - - - - - - - - - - ------
public static void CreateTask()
{
using (TaskService task = new TaskService())
{`enter code here`
TaskDefinition taskdDef = task.NewTask();
taskdDef.RegistrationInfo.Description = "Does something";
taskdDef.RegistrationInfo.Documentation = "http://www.mysite.com";
taskdDef.Settings.ExecutionTimeLimit = new TimeSpan(0, 10, 0);
taskdDef.Settings.AllowDemandStart = true;
taskdDef.Actions.Add(new ExecAction(@"D:\Myfolder\bin\SGSclient.exe", "yourArguments", null));
task.RootFolder.RegisterTaskDefinition("YourTask", taskdDef);
}
}