Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











Method:  WshShell.ExpandEnvironmentStrings

WshShell.ExpandEnvironmentStrings strString

The ExpandEnvironmentStrings method expands the environment variables in strString and returns the resulting string. Environment variables are case-insensitive and are enclosed by a pair of % characters. If an environment variable in strString is undefined, then it is left unchanged.

The following VBScript code illustrates the behavior of this method.

Code:
Set WshShell = CreateObject("WScript.Shell")

strOriginalString = "Windows is installed in %WinDir%. %XYZ% is undefined."
strExpandedString = WshShell.ExpandEnvironmentStrings(strOriginalString)

WScript.Echo "Before: " & strOriginalString
WScript.Echo "After: " & strExpandedString


Output:
Before: Windows is installed in %WinDir%. %XYZ% is undefined.
After: Windows is installed in C:\WINNT. %XYZ% is undefined.

 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information