The following code expands the Windows Directory environment variable and displays it:
JScriptvar WshShell = WScript.CreateObject("WScript.Shell");
WScript.Echo("WinDir is " + WshShell.ExpandEnvironmentStrings("%WinDir%"));
VBScriptset WshShell = WScript.CreateObject("WScript.Shell")
WScript.Echo "WinDir is " & WshShell.ExpandEnvironmentStrings("%WinDir%")
PowerBASICDIM pWsh AS IWshShell
pWsh = NEWCOM "WScript.Shell"
PRINT ACODE$(pWsh.ExpandEnvironmentStrings(UCODE$("%WinDir%")))