Export (0) Print
Expand All

ProcessStartInfo.EnvironmentVariables Property

Gets search paths for files, directories for temporary files, application-specific options, and other similar information.

Namespace: System.Diagnostics
Assembly: System (in system.dll)

public StringDictionary EnvironmentVariables { get; }
/** @property */
public StringDictionary get_EnvironmentVariables ()

public function get EnvironmentVariables () : StringDictionary

Not applicable.

Property Value

A StringDictionary that provides environment variables that apply to this process and child processes. The default is a null reference (Nothing in Visual Basic).

Although you cannot set the EnvironmentVariables property, you can modify the StringDictionary returned by the property. For example, the following code adds a TempPath environment variable: myProcess.StartInfo.EnvironmentVariables.Add("TempPath", "C:\\Temp"). You must set the UseShellExecute property to false to start the process after changing the EnvironmentVariables property. If UseShellExecute is true, an InvalidOperationException is thrown when the Start method is called.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft