Msi Environment
From wikinotes
Set Environment Variables.
Documentation
Environment table https://docs.microsoft.com/en-us/windows/win32/msi/environment-table
Overview
Table Columns Environment TESTVAR
primary key/handle Name *=-TEST
name of the environment-variable (localized) Value [~];1
value of environment variable. Component_ TESTVAR_ENV
primary-key of envvar's component. Python Example
# Add Component to Feature (so it is installed) featcomp_data = [('Everything', 'Foo_Reg')] msilib.add_data(db, 'FeatureComponents', featcomp_data) # Create Component for RegistryKey comp_data = [('Foo_Reg', # Component msilib.gen_uuid(), # ComponentId 'TARGETDIR', # Directory_ 2, # Attributes None, # Condition None)] # KeyPath msilib.add_data(db, 'Component', comp_data) # Define RegistryKey env_data = [('Foo_Reg', # Environment '=-Foo', # Name (installed/uninstalled) 'Bar', # Value 'Foo_Reg')] # Component_ msilib.add_data(db, 'Environment', env_data)
User/System Variable
Environment variables are user variables by default.
If you desire a system-wide variable, use the prefix*
in the column Name.
This precedes the prefix to designate add/remove variable, if present.*SYSTEM_VARIABLE USER_VARIABLE
Add/Remove Variable
Adding/Removing variables is indicated with a Name column prefix.
=VARIABLE # create if not exist, set during install regardless of whether or not it already exists +VARIABLE # create if not exist, only set if does not already exist -VARIABLE # remove variable when application is uninstalled !VARIABLE # remove variable at install # these can be combined =-VARIABLE # set on install, removed on uninstall
Append/Prepend Value
By default variables are replaced.
To append/prepend use[~];
at the start or end of the Value column.VALUE # replace value (depends on 'Name' col prefix) [~];VALUE # append value VALUE;[~] # prepend value