Executes a Windows process with given command line parameters and captures console output into a string.
Writes command output to the output StringBuilder from StdOut and StdError.
public static int ExecuteProcess(string executable, string arguments, int timeoutMs, ref StringBuilder output, ProcessWindowStyle windowStyle, Action<Boolean> completionDelegate)
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.
output
Pass in a string reference that will receive StdOut and StdError output
windowStyle
Hidden, Normal, etc.
completionDelegate
Overloads:
public static int ExecuteProcess(string executable, string arguments, int timeoutMs, ProcessWindowStyle windowStyle)
public static int ExecuteProcess(string executable, string arguments, int timeoutMs, Action
See also:
Class ShellUtils© West Wind Technologies, 1996-2024 • Updated: 06/29/24
Comment or report problem with topic