Author Topic: IWshShell.ExpandEnvironmentStrings Property  (Read 2638 times)

0 Members and 1 Guest are viewing this topic.

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2524
  • User-Rate: +209/-0
  • Gender: Male
IWshShell.ExpandEnvironmentStrings Property
« on: July 14, 2008, 07:52:06 AM »

The following code expands the Windows Directory environment variable and displays it:

JScript

Code: [Select]
var WshShell = WScript.CreateObject("WScript.Shell");
WScript.Echo("WinDir is " + WshShell.ExpandEnvironmentStrings("%WinDir%"));

VBScript

Code: [Select]
set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Echo "WinDir is " & WshShell.ExpandEnvironmentStrings("%WinDir%")

PowerBASIC

Code: [Select]
DIM pWsh AS IWshShell
pWsh = NEWCOM "WScript.Shell"
PRINT ACODE$(pWsh.ExpandEnvironmentStrings(UCODE$("%WinDir%")))