Microsoft® Windows® Script Host ExpandEnvironmentStrings Method |
WSH Reference Version 1 |
Expands the requested environment variable from the running process and returns the result string.
object.ExpandEnvironmentStrings(strString)
Part Description object WshShell object. strString Name of the environment variable to expand.
Variables are enclosed by the "%" character. The environment variable name is not case-sensitive.
The following example expands the WinDir environment variable and displays it in a message box:set WshShell = CreateObject("WScript.Shell") WScript.Echo "WinDir is " & WshShell.ExpandEnvironmentStrings("%WinDir%")