Name
ProcessStartInfo
Synopsis
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 have 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 ...
Get C# in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.