Retrieves the value of an environment variable from the current process or from the Windows operating system registry key for the current user or local machine.
- variable
- The name of an environment variable.
- target
- One of the EnvironmentVariableTarget values.
The value of the environment variable specified by the variable and target parameters, or null if the environment variable is not found.
The target parameter specifies whether the environment variable is retrieved from the current process or from the Windows operating system registry key for the current user or local machine.
Environment variable names are not case-sensitive.
To retrieve all environment variables along with their values, call the Environment.GetEnvironmentVariables method.