O'Reilly logo

C# in a Nutshell by Peter Drayton, Ted Neward, Ben Albahari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required