TaskRun Method

Runs the registered task immediately.

Definition

Namespace: Microsoft.Win32.TaskScheduler
Assembly: Microsoft.Win32.TaskScheduler (in Microsoft.Win32.TaskScheduler.dll) Version: 2.11.0
public RunningTask Run(
	params string[] parameters
)

Parameters

parameters  String

The parameters used as values in the task actions. A maximum of 32 parameters can be supplied. To run a task with no parameters, call this method without any values (e.g.

C#
Run()
).

The string values that you specify are paired with names and stored as name-value pairs. If you specify a single string value, then Arg0 will be the name assigned to the value. The value can be used in the task action where the $(Arg0) variable is used in the action properties.

If you pass in values such as "0", "100", and "250" as an array of string values, then "0" will replace the $(Arg0) variables, "100" will replace the $(Arg1) variables, and "250" will replace the $(Arg2) variables used in the action properties.

For more information and a list of action properties that can use $(Arg0), $(Arg1), ..., $(Arg32) variables in their values, see Task Actions.

Return Value

RunningTask
A RunningTask instance that defines the new instance of the task.

Example

C#
// Run the current task with a parameter
var runningTask = myTaskInstance.Run("info");
Console.Write(string.Format("Running task's current action is {0}.", runningTask.CurrentAction));

See Also