Returns an NT environment variable.
Syntax WshShell.Environment([strType]) Arguments: [strType] is one of "System" (HKLM), "User" (HKCU), "Volatile" or "Process" Example 'Write to env variables Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Environment("USER").Item("MyVar1") = "hello" WshShell.Environment("USER").Item("MyVar2") = "world" 'Read Env Variables WScript.Echo WshShell.Environment("USER").Item("MyVar1") WScript.Echo WshShell.Environment("USER").Item("MyVar2") ' Retrieve the %COMPUTERNAME% system environment variable WScript.Echo WshShell.Environment("PROCESS").Item("COMPUTERNAME") ".Item" is actually the default property and can be omitted
"It is possible to store the mind with a million facts and still be entirely uneducated" - Alec Bourne
Related commands:
expand env variables - WshShell.ExpandEnvironmentStrings
delete env variables - WshShell.WshEnvironment.Remove
Equivalent Windows NT command:
SET - Display, set, or remove Windows NT environment
variables