• Welcome to Jose's Read Only Forum 2023.
 

IWshShell.ExpandEnvironmentStrings Property

Started by José Roca, July 14, 2008, 07:52:06 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



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

JScript


var WshShell = WScript.CreateObject("WScript.Shell");
WScript.Echo("WinDir is " + WshShell.ExpandEnvironmentStrings("%WinDir%"));


VBScript


set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Echo "WinDir is " & WshShell.ExpandEnvironmentStrings("%WinDir%")


PowerBASIC


DIM pWsh AS IWshShell
pWsh = NEWCOM "WScript.Shell"
PRINT ACODE$(pWsh.ExpandEnvironmentStrings(UCODE$("%WinDir%")))