Registry
For All Currents Users there are to hive :
HKEY_CURRENT_USER \ Environment
This hive is just a copy of HKEY_USERS\.DEFAULT\Environment. Give the location of the TEMP directory for the current user.
For the Current user session
HKEY_CURRENT_USER\Volatile Environment
This one is very usefull, for Custum Action. Because the CA run with the system user. Here a short list of the environments variables (not all of them) :
%APPDATA%
%USERNAME%
%USERPROFILE%
%USERDOMAIN%
For the system :
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ Environment
With this hive, there all the environements variables display when we type "set" command in DOS. This is the list of the main variables :
%Path%, %ComSpec%, %windir%, %PROCESSOR_ARCHITECTURE%
VBScript Sample
Set WshShellObj = WScript.CreateObject("WScript.Shell")
'context : Process, System, Volatile
context = "User"
Set WshProcessEnv = WshShellObj.Environment(context)
WScript.Echo WshProcessEnv("USERNAME")
Custom Action (Set Property)
With User Interface
With the table
Do you have other tips or tricks about Variable Environment ?
Comments