Scripting Home > > WScript Methods

ExpandEnvironmentStrings Method

Description

The ExpandEnvironmentStrings method returns a string containing the requested substituted environment variable.

object.ExpandEnvironmentStrings (EnvVariable)

The EnvVariable parameter specifies which environment variable to expand and return.

Example

'VBScript Example
set WshShell = CreateObject("WScript.Shell")
WScript.Echo WshShell.ExpandEnvironmentStrings("%SystemRoot%")
WScript.Echo WshShell.ExpandEnvironmentStrings("%WinDir%")