Archive: ReadEnvStr not reading correctly


ReadEnvStr not reading correctly
Hi,

It seems ReadEnvStr is not reading changes inside a given install instance.

ie, My code:
..
ExecWait "setup.exe" ; install section and set JAVA_HOME

ReadEnvStr $0 "JAVA_HOME"

ExecWait "echo $0" ; not set

__

is there some way i can reload the env str?

or is executing a new instance equivalent?

ExecWait "setup.exe" ; install section and set JAVA_HOME
ReadEnvStr $R0 COMSPEC
ExecWait '"$R0" /C echo %JAVA_HOME%'

thought id ask cos u guys seems to be on top of your game :p


I'm curious to know what happens if you try to use the command without the quotation marks.


It depends on what setup.exe did. If it added a local environment variable, JAVA_HOME will disappear after "ExecWait setup.exe". If it added a system environment variable, you may read it from Windows Registry for WinNT/2000/XP (for win9x, you cannot read it before rebooting). For the registry entry, please search related scripts in NSIS archive.


RobGrant, if you are refering to the "" around ReadEnvStr. It made no difference with or without.

hooklee, setup.exe is writing a system env variable. I see you can get around it by getting the env setting from the registry but is there no way to read it using ReadEnvStr or ExecWait '"$R0" /C echo %JAVA_HOME%'?

after execution i can open a cmd window and type:
echo %JAVA_HOME%


ok, reading from the registry seems to be the way to go.

thks!