Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 17th June 2003, 17:33   #1
dsteenburg
Junior Member
 
Join Date: Jun 2003
Location: Ontario, Canada
Posts: 14
Path Evironment Variable code not working (sort of)

Hi, again.

I got the following code of NSIS site somewhere (can't recall if it was in the archive or someone's post). The purpose is to modify the environment path to add a couple of /bin directories to the beginning of the path.

;add to Registry PATH
Push $R0
Push $R1
StrCpy $R0 "PATH"
ReadEnvStr $R1 "$R0"
MessageBox MB_OK "Current PATH = $R1"
StrCpy $R1 "$INSTDIR\mars\cygwin\bin;C:\jdk1.3.1_08\bin;$R1"
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("$R0", "$R1").r0'
ReadEnvStr $R1 "$R0"
MessageBox MB_OK "Updated PATH = $R1"
Pop $R1
Pop $R0

When running the install program, it seems like it is working really well. The two MessageBoxes show the path before and after, and it looks like it has worked. I.e., $R1 after the second ReadEnvStr does show the change. But when the install program has finished and I go to regedit to ensure that all the registry changes are accurate, the path variable is unchanged.

Can anyone figure out
1) why it looks like it is working? Is it only making a temporary change that is undone when the install program ends?

2) how to make it really work?

Dave
dsteenburg is offline   Reply With Quote
Old 17th June 2003, 19:06   #2
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
It's only a temporary change. To make them permanent, you have to change the registry (Windows NT). For Windows 9x/ME, you should write to Autoexec.bat

And searching the Archive is always a good idea: http://nsis.sourceforge.net/archive/....php?pageid=91
Joost Verburg is offline   Reply With Quote
Old 17th June 2003, 20:05   #3
dsteenburg
Junior Member
 
Join Date: Jun 2003
Location: Ontario, Canada
Posts: 14
Thanks, Joost.

Usually I do search the archive before I post, but failed to this time. Sorry.

Dave
dsteenburg is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump