ProcessStartInfo.Environment ProcessStartInfo.Environment ProcessStartInfo.Environment ProcessStartInfo.Environment Property


Gets the environment variables that apply to this process and its child processes.

 property System::Collections::Generic::IDictionary<System::String ^, System::String ^> ^ Environment { System::Collections::Generic::IDictionary<System::String ^, System::String ^> ^ get(); };
public System.Collections.Generic.IDictionary<string,string> Environment { get; }
member this.Environment : System.Collections.Generic.IDictionary<string, string>
Public ReadOnly Property Environment As IDictionary(Of String, String)

Property Value

A generic dictionary containing the environment variables that apply to this process and its child processes. The default is null.


The environment variables contain search paths for files, directories for temporary files, application-specific options, and other similar information. Although you cannot directly set the Environment property, you can modify the generic dictionary returned by the property. For example, the following code adds a TempPath environment variable: myProcess.StartInfo.Environment.Add("TempPath", "C:\\Temp"). You must set the UseShellExecute property to false to start the process after changing the Environment property. If UseShellExecute is true, an InvalidOperationException is thrown when the Start method is called.

On .NET Framework applications, using the Environment property is the same as using the EnvironmentVariables property.

Applies to

See also