tao.shen
9th May 2005 05:31 UTC
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
RobGrant
9th May 2005 08:46 UTC
I'm curious to know what happens if you try to use the command without the quotation marks.
hooklee
9th May 2005 10:29 UTC
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.
tao.shen
10th May 2005 06:25 UTC
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%
tao.shen
10th May 2005 07:51 UTC
ok, reading from the registry seems to be the way to go.
thks!