| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
wintasks is a simple wrapper for managing tasks in the Windows Task Scheduler.
This is a thin wrapper around the excellent Microsoft.Win32.TaskScheduler library optimized for the most common use-case of creating a task that repeats on an interval.
It includes a utility for managing the re-deployment of tasks by waiting for a task to complete before disabling - thereby allowing a deployment script to ensure that the binaries are not locked.
The main entry point is the TaskHelper class which contains two main functions - Disable and Install.
Typically, in a deployment script, you would want to disable your tasks, copy your binaries, and re-enable the tasks.
An example of two task definitions is as follows:
var tasks
= new List<RepetitiveTask>
{
new RepetitiveTask
{
Name = "My first task",
Description = "Does something on a regular interval.",
Parameters = @"--myparam=true",
RunsEveryHowManyMinutes = 15
},
new RepetitiveTask
{
Name = "My other task",
Description = "Also does something on a regular interval.",
Path = @"c:\\bar\\baz.exe",
Parameters = "--myotherparam=false",
RunsEveryHowManyMinutes = 1
}
};To install these tasks in the Windows Task Scheduler, you would use the TaskHelper as follows:
var helper = new TaskHelper();
helper.Install(tasks);To disable these tasks, you could do as follows:
var helper = new TaskHelper();
helper.Disable(tasks);Typically, in an install script, you would want to first disable the tasks, then copy the binaries, and then run the install command. It is safe to run the disable even if the tasks have never been installed; it will not raise an exception if a disabled task does not exist.
| Back | FazBrowse Home | New Git URL |