Is possible to run existing task with argument?

Nov 14, 2012 at 2:30 PM

I do the following calls:

TaskService service = new TaskService();

Task task = service.FindTask("TaskName");

task.Run(new string[] { "c:\\data.xml" });


Task started but program didn't get any argument. What I did wrong?

Nov 14, 2012 at 7:08 PM

You must specify in the ExecAction that you are willing to take arguments. See towards the bottom of the page under "Using Variables in Action Properties" for more information.

Nov 15, 2012 at 6:50 AM

Thanks dahall! Your solution works.

Jun 13, 2013 at 3:29 PM
If you want to run an existing task (you set it up manually on the remote computer and did not use the Task Scheduler Manage Wrapper in code to do this) be sure to put in $(Arg0) as the (only) argument.