diff --git a/docs/fundamentals/runtime-libraries/system-environment-getenvironmentvariable.md b/docs/fundamentals/runtime-libraries/system-environment-getenvironmentvariable.md index c08d6b6f2f5fb..c5531c2fac8d2 100644 --- a/docs/fundamentals/runtime-libraries/system-environment-getenvironmentvariable.md +++ b/docs/fundamentals/runtime-libraries/system-environment-getenvironmentvariable.md @@ -9,14 +9,17 @@ ms.date: 01/24/2024 The method retrieves the value of an environment variable from the current process. +Environment variable names are case-sensitive on Unix-like systems but aren't case-sensitive on Windows. + +> [!NOTE] +> In-process environment modifications made by native libraries aren't seen by managed callers. Conversely, such modifications made by managed callers aren't seen by native libraries. + ## method The method retrieves an environment variable from the environment block of the current process only. It's equivalent to calling the method with a `target` value of . To retrieve all environment variables along with their values, call the method. -Environment variable names are case-sensitive on non-Windows systems but are not case-sensitive on Windows. - ### On Windows systems On Windows systems, the environment block of the current process includes: @@ -29,29 +32,27 @@ On Windows systems, the environment block of the current process includes: If environment variables are created after the process has started, you can use this method to retrieve only those variables that were created by calling the method or the method with a `target` value of .. -### On non-Windows systems +### On Unix-like systems -On non-Windows systems, the environment block of the current process includes the following environment variables: +On Unix-like systems, the environment block of the current process includes the following environment variables: - All environment variables that are provided to it by the parent process that created it. For .NET applications launched from a shell, this includes all environment variables defined in the shell. - Any variables added to the process block while the process is running by calling either the method or the method with a `target` value of . These environment variables persist until the .NET application terminates. -.NET on non-Windows systems does not support per-machine or per-user environment variables. +.NET on Unix-like systems does not support per-machine or per-user environment variables. ## method To retrieve all environment variables along with their values, call the method. -Environment variable names are case-sensitive on non-Windows systems but are not case-sensitive on Windows. - ### On Windows systems On Windows, 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. All per-user and per-machine environment variables are automatically copied into the environment block of the current process, as are any other environment variables that are available to the parent process that created the .NET process. However, environment variables added only to the environment block of the current process by calling either the method or the method with a `target` value of persist only for the duration of the process. -### On non-Windows systems +### On Unix-like systems -On non-Windows systems, the `GetEnvironmentVariable(String, EnvironmentVariableTarget)` method supports a `target` value of only. Calls with a `target` value of or are not supported and return `null`. +On Unix-like systems, the `GetEnvironmentVariable(String, EnvironmentVariableTarget)` method supports a `target` value of only. Calls with a `target` value of or are not supported and return `null`. Per-process environment variables are: