cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
TomCarey
Level 4

get system env variable

You can set a system environment variable, and you can refresh the
the windows environment, but where is the Action to Get a system environment variable???
Labels (1)
0 Kudos
(5) Replies
SunnyBoy
Level 6

Get a system environment variable can be retrieved using getEnvironmentVariable() method this is present in SystemUtilService Interface. This Interface performs system-level operations.

getRawEnvironmentVariable
java.lang.String getRawEnvironmentVariable(java.lang.String variableName, int level) throws ServiceException

This method is useful to developers when creating a custom bean. Gets the raw value of the specified environment variable. For operating systems whose environment variable settings are script-controlled, this returns the value of the environment variable from the InstallShield section of the script. For other operating systems, this method acts the same as getEnvironmentVariable . The returned value may contain references to environment variables that are not resolved.

Parameters:
variableName - - The name of the variable for which to return a value.
level - - Specifies the level of the environment variable. This parameter may be ignored on platforms which do not support the setting of environment variables at different levels (e.g., Win9x).

Returns:
A string containing the value of the environment variable; null if the environment variable does not exist

Regards
SunnyBoy
0 Kudos
TomCarey
Level 4

thanks for the quick response. I was hoping for an InstallAnywhere Action from the Add Action panel. I just found it somewhat limited that a Set action is provided without the corresponding Get action.
0 Kudos
avudaithangam
Level 5

InstallAnywhere has an action to get environment variables. We can use

$lax.nl.env.SYSTEM_ENV_VARIABLE_NAME$.

For example, to get JAVA_HOME we have to use $lax.nl.env.JAVA_HOME$.
0 Kudos
TomCarey
Level 4

thanks for the reply, I will give it a try.
BTW where are the $lax.nl.env.???$. variables documented?
0 Kudos
SunnyBoy
Level 6

lax.nl.env.variable_name and lax.nl.env.exact_case.variable_name properties can be used to access any system environment variable.

Below article provides more information on LAX variables.

http://kb.flexerasoftware.com/selfservice/microsites/search.do?cmd=displayKC&docType=kc&externalId=IA2011-Content-helplibrary-iarefvariableslaxpropertieshtm&sliceId=&docTypeID=DT_MACROVISIONHELPNET_1_1&dialogID=121581850&stateId=0%200%20121577888

Regards
SunnyBoy
0 Kudos