EnvGet [v1.0.43.08+]

Retrieves an environment variable.

EnvGet, OutputVar, EnvVarName

Parameters

OutputVar

The name of the variable in which to store the string.

EnvVarName

The name of the environment variable to retrieve. For example: EnvGet, OutputVar, Path.

Remarks

If the specified environment variable is empty or does not exist, OutputVar is made blank.

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

EnvSet, #NoEnv, environment variables, EnvUpdate, SetEnv, Run, RunWait

Examples

Retrieves an environment variable and stores its value 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%