ShellUtils.ExecuteProcess

Executes a Windows process with given command line parameters and captures console output into a string.

Pass in a String Action that receives output from StdOut and StdError as it is written (one line at a time).

public static int ExecuteProcess(string executable,
	string arguments,
	int timeoutMs,
	Action<String> writeDelegate,
	ProcessWindowStyle windowStyle)

Return Value

process exit code or 0 if run and forget. 1460 for time out. -1 on error

Parameters

executable
Executable to run

arguments
Command Line Parameters passed to executable

timeoutMs
Timeout of the process in milliseconds. Pass -1 to wait forever. Pass 0 to not wait.

writeDelegate
Action to capture stdout and stderror output for you to handle

windowStyle
Hidden, Normal etc.

Overloads:


See also:

Class ShellUtils

© West Wind Technologies, 2019 • Updated: 06/23/19
Comment or report problem with topic