CommandLineFormatter Class
Formats the executable and the arguments of a process as one command line, for display.
public static class CommandLineFormatterMethods
| Name | Description |
|---|---|
| Format(string, IEnumerable<string>) | Formats an executable and its arguments as one command line, for display. |
Format(string, IEnumerable<string>)
Formats an executable and its arguments as one command line, for display.
public static string Format(string executable, IEnumerable<string> arguments)Parameters
executablestring- The name or the path of the program.
argumentsIEnumerable<string>- The arguments of the program.
Returns
string The executable, then each argument, separated by spaces.
Exceptions
ArgumentNullExceptionexecutableisnull. - or -argumentsisnull.ArgumentExceptionargumentsholds anullitem.
Remarks
An item that is empty, or that holds a space, a tab, or a double quote, is enclosed in double quotes, and each double quote in it is preceded by a backslash. Any other item is shown as it is.
The result is meant to be read by a person. No shell and no program is guaranteed to split it back into the same items, because the rules for that differ between operating systems.