This class is used to configure
how a process is started or
to view the settings a process was started with. To start a process,
set FileName to the full path of the application
or file, then pass the ProcessStartInfo instance
to Process.Start( ). FileName
is the only property you must set. Use the other properties for more
control. (Use Arguments to specify the
command-line arguments.)
In Windows, each document type has a verb that you can use to do
different things with (for example, a Microsoft Word document has an
open and a print verb). To
consult the possible verbs for a specific file, enumerate the
Verbs property after you set
FileName. To start a process with a specific verb,
set Verb.
To change the standard error, input, or output source or targets
(usually the system console), set one or more of
RedirectStandardError,
RedirectStandardInput, or
RedirectStandardOutput to true.
This enables the Process.StandardError,
Process.StandardInput, and
Process.StandardOutput properties, which you can
then set as needed. Set the EnvironmentVariables
and WorkingDirectory to change the default process
start behavior. If the process cannot be started, you can display an
error dialog window by setting ErrorDialog (set
the handle of the dialog's parent window with
ErrorDialogParentHandle). If you set
CreateNoWindow, a new window is not created to
start the new process. However, if you want a window, set its style
by setting WindowStyle. You can also specify that
the file should be executed from a Windows command prompt with
UseShellExecute.
public sealed class ProcessStartInfo {
// Public Constructors
public ProcessStartInfo( );
public ProcessStartInfo(string fileName);
public ProcessStartInfo(string fileName, string arguments);
// Public Instance Properties
public string Arguments{set; get; }
public bool CreateNoWindow{set; get; }
public StringDictionary EnvironmentVariables{get; }
public bool ErrorDialog{set; get; }
public IntPtr ErrorDialogParentHandle{set; get; }
public string FileName{set; get; }
public bool RedirectStandardError{set; get; }
public bool RedirectStandardInput{set; get; }
public bool RedirectStandardOutput{set; get; }
public bool UseShellExecute{set; get; }
public string Verb{set; get; }
public string[ ] Verbs{get; }
public ProcessWindowStyle WindowStyle{set; get; }
public string WorkingDirectory{set; get; }
}