To expand an environment variable in VBScript, use the ExpandEnvironmentStrings method.

Example:

                              Set oShell = CreateObject( "WScript.Shell" )                              user=oShell.ExpandEnvironmentStrings("%UserName%")                              comp=oShell.ExpandEnvironmentStrings("%ComputerName%")                              WScript.Echo user & " " & comp