geoffrey_4js
2nd February 2005 15:18 UTC
ReadEnvStr problem
Hi!
I'm using ReadEnvStr to get the environement variable PATH (local user).
The problem is that ReadEnvStr seems to double the PATH (if PATH is C:\WinNT;C:\toto, i get C:\WinNT;C:toto;C:\WinNT;C:\toto)
ReadEnvStr $R0 PATH
MessageBox MB_OK "PATH : $R0"
How can I make it work ?
EDIT : in fact ReadEnvStr add the system environement variable PATH to the current user environement variable PATH ! Is it something I miss to make ReadEnvStr only get the current user environement variable ?
Geoffrey
Afrow UK
2nd February 2005 17:24 UTC
Try ExpandEnvStrings
-Stu
Afrow UK
2nd February 2005 17:28 UTC
ReadEnvStr $R0 PATH works find for me.
This is the value of PATH for me:
C:\usr\bin\;C:\Perl\bin\;C:\WINDOWS\SYSTEM32;C:\WINDOWS;C:\WINDOWS\SYSTEM32\WBEM;C:\PROGRAM FILES\ATI TECHNOLOGIES\ATI CONTROL PANEL;C:\Program Files\Panda Software\Panda Antivirus Titanium\;C:\Program Files\Panda Software\Panda Titanium Antivirus 2004\;C:\Program Files\Common Files\Autodesk Shared\;C:\Program Files\ATI Technologies\ATI.ACE\;C:\BITWARE\;;C:\PROGRA~1\COMMON~1\AUTODE~1
No repetitions...
-Stu
geoffrey_4js
2nd February 2005 17:36 UTC
Here is the part of code
ReadEnvStr $R2 PATH
${WriteEnvStr} $R7 "PATH" "$R1\fgl\bin;$R1\mysql\bin;$R2"
And the values I get :
BEFORE INSTALL :
PATH --> LOCAL USER
C:\Program Files\CVS\CVS\Tcl\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\UltraEdit;C:\Program Files\Informix\Client-SDK\bin
PATH --> SYSTEM
C:\Program Files\CVS\CVS\Tcl\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\UltraEdit;C:\Program Files\Informix\Client-SDK\bin
AFTER INSTALL :
PATH --> LOCAL USER
C:\PROGRA~1\FourJs\gep\fgl\bin;C:\PROGRA~1\FourJs\gep\mysql\bin;C:\Program Files\FourJs\gep 1.00.1c\mysql\bin;C:\Program Files\FourJs\gep 1.00.1c\fgl\bin;C:\Program Files\CVS\CVS\Tcl\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\UltraEdit;C:\Program Files\Informix\Client-SDK\bin;C:\Program Files\FourJs\gep 1.00.1c\mysql\bin;C:\Program Files\FourJs\gep 1.00.1c\fgl\bin;C:\Program Files\CVS\CVS\Tcl\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\UltraEdit;C:\Program Files\Informix\Client-SDK\bin
PATH --> SYSTEM
C:\Program Files\CVS\CVS\Tcl\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\UltraEdit;C:\Program Files\Informix\Client-SDK\bin
It doubles everything.
I've find a way to escape this but i'm not sure it's clean but it works :
ReadRegStr $R2 HKCU "Environment" PATH
${WriteEnvStr} $R7 "PATH" "$R1\fgl\bin;$R1\mysql\bin;$R2"
kichik
3rd February 2005 18:47 UTC
There is a special piece of code for handling the PATH variable. Use that instead of WriteEnvStr.
geoffrey_4js
7th February 2005 11:15 UTC
Thx kichik, i'll try that.