Expands environment-variable strings. (version 4.71 or later)
expandenv <strvar> [<strval>]
The expandenv command expands one or more environment-variable strings(%variableName%) and replaces them with the values for the current user.
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