Quantcast
Viewing all articles
Browse latest Browse all 2206

New Post: Create daily 9h Task Schedule in Windows 7

// Get the service on the local machine
using (TaskService ts = new TaskService())
{
   // Create a new task definition and assign properties
   TaskDefinition td = ts.NewTask();
   td.RegistrationInfo.Description = "Daily trigger";
   td.Principal.LogonType = TaskLogonType.InteractiveToken;

   // Add a trigger that will fire the task at this time every other day
   td.Triggers.Add(new DailyTrigger { StartBoundary = DateTime.Today.AddHours(9) });

   // Add an action that will launch Notepad whenever the trigger fires
   td.Actions.Add(new ExecAction("C:\\Launcher.exe"));

   // Register the task in the root folder
   ts.RootFolder.RegisterTaskDefinition("Scheduler", td);
}

Viewing all articles
Browse latest Browse all 2206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>