expandenv

Expands environment-variable strings.

Format

expandenv <strvar> [<strval>]

Parameters

string variable <strvar>
The specified string is expanded.
When the second argument(<strval>) is given, the result expanding the argument stores into the string variable <strvar>.
string <strval> (optional)
When this argument is given, the result expanding the argument stores into the string variable <strvar>.

Remarks

The expandenv command expands one or more environment-variable strings(%variableName%) and replaces them with the values for the current user.

Example

str = "%WINDIR%\notepad.exe"
expandenv str
messagebox str "env"    ; C:\WINDOWS\notepad.exe
expandenv str "%WINDIR%\notepad.exe"
messagebox str "env"    ; C:\WINDOWS\notepad.exe
expandenv str "%test%\notepad.exe"
messagebox str "env"    ; %test%\notepad.exe

See also