Microsoft® Windows® Script Host
ExpandEnvironmentStrings Method
WSH Reference
Version 1

Applies To


Description
Expands the requested environment variable from the running process and returns the result string.
Syntax
object.ExpandEnvironmentStrings(strString)
Parameters
Part Description
object WshShell object.
strString Name of the environment variable to expand.
Remarks
Variables are enclosed by the "%" character. The environment variable name is not case-sensitive.
Example
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%")