RegisteredTask.Run method

For scripting, runs the registered task immediately.


RegisteredTask.Run( _
  ByVal params, _
  ByRef ppRunningTask _


params [in]

The parameters used as values in the task actions. To not specify any parameter values for the task actions, set this parameter to Nothing. Otherwise, a single string value or an array of string values can be specified.

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.

A maximum of 32 string values can be specified.

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

ppRunningTask [out]

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

Return value

This method does not return a value.


The RegisteredTask.Run function is equivalent to the RegisteredTask.RunEx function with the flags parameter equal to 0 and nothing specified for the user parameter.

This method will return without error, but the task will not run if the TaskSettings.AllowDemandStart property is set to false for the registered task.


Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
Type library

See also

Task Scheduler