Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Method: void SetCommand(IEnumerable<string>)

Declaration

public void SetCommand(
    IEnumerable<string> args
)

Summary

Sets the CommandRunner.Command property by combining and escaping all arguments in such a way that a program parsing them with standard Windows tools will receive the exact strings passed in. Null values are allowed and are filtered out. The first value is escaped as a path to an executable and all others as parameters. Thus it is not possible to use this method to construct arguments that are handled specially by cmd.exe such as redirects, pipes and environment variable expansions.

Remarks

Example: SetCommand(new[] { @"C:\Program Files\Foo\Foo.exe", "-f", @"C:\Some Path\file.txt" });. See also CommandRunner.ArgsToCmdExeLine(IEnumerable<string>) which performs the same exact escaping but returns the value instead.