EnvironmentVariableTarget Enumeration

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Specifies the location where an environment variable is stored or retrieved in a set or get operation.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

[<ComVisibleAttribute(true)>]
type EnvironmentVariableTarget

Member nameDescription
Machine

The environment variable is stored or retrieved from the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment key in the Windows operating system registry.

Process

The environment variable is stored or retrieved from the environment block associated with the current process.

User

The environment variable is stored or retrieved from the HKEY_CURRENT_USER\Environment key in the Windows operating system registry.

The EnvironmentVariableTarget enumeration is used by certain overloads of the SetEnvironmentVariable, GetEnvironmentVariable, and GetEnvironmentVariables methods to specify the location, or target, where the name and value of an environment variable is stored or retrieved.

The target can be one of three locations: the environment block associated with the current process, the Windows operating system registry key reserved for environment variables associated with the current user, or the registry key reserved for environment variables associated with all users on the local machine.

The following code example demonstrates the EnvironmentVariableTarget enumeration in methods that create, modify, and delete environment variables.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: