EnvGet [v1.0.43.08+]

Retrieves the value of the specified environment variable.

EnvGet, OutputVar, EnvVar

Parameters

OutputVar

The name of the output variable in which to store the retrieved value.

EnvVar

The name of the environment variable, e.g. Path.

Remarks

If EnvVar has an empty value or does not exist, OutputVar is made blank.

The operating system limits each environment variable to 32 KB of text.

EnvSet, #NoEnv, EnvUpdate, SetEnv, Run / RunWait

Examples

Retrieves the value of an environment variable and stores it in OutputVar.

EnvGet, OutputVar, LogonServer

Retrieves and reports the path of the "Program Files" directory. See RegRead example #2 for an alternative method.

EnvGet, OutputVar, % A_Is64bitOS ? "ProgramW6432" : "ProgramFiles"
MsgBox, Program files are in: %OutputVar%

Retrieves and reports the path of the current user's Local AppData directory.

EnvGet, LocalAppData, LocalAppData
MsgBox, %A_UserName%'s Local directory is located at: %LocalAppData%