Pardsbane
12th September 2001 19:05 UTC
Modifying Environment variables
Hello,
is there an easy way to use NSIS to modify environment variables? I'm trying to write an nsis installer for a software library, and I would like to be able to add a pathname to the PATH, INCLUDE, and LIB environment variables, and have that path removed on uninstall.
One problem I discovered with this is that the WriteRegStr command replaces REG_EXPAND_SZ keys to REG_SZ keys, which messes up the PATH environment variable at the very least.
Is there a solution for either of these two (related) problems?
Gonzotek
12th September 2001 20:05 UTC
Could you use:
WriteINIStr ini_filename section_name entry_name value
Writes entry_name=value into ini_filename in [section_name]. All of the parameters can contain variables. If the string could not be written to the ini file, the error flag is set.
DeleteINISec ini_filename section_name
Deletes the entire section [section_name] from ini_filename. If the section could not be removed from the ini file, the error flag is set.
DeleteINIStr ini_filename section_name str_name
Deletes the string str_name from section [section_name] from ini_filename. If the string could not be removed from the ini file, the error flag is set.
to write to autoexec.bat and/or config.sys?
It's been awhile since I had to add a path variable, but I remember hand-editing the startup files....
-=Gonzotek=-
Pardsbane
12th September 2001 20:22 UTC
Don't think so
I don't think you can use INI functions to modify the Autoexec.bat, but even if you could, that doesn't provide the needed string editing functions (search the string for a variable, remove it, etc)