PDA

View Full Version : Edit Environment Variable bug?



JerryS@cat
07-16-2015, 09:50 AM
As is usual before posting something, I did do some searching through the forums to see if I could find the answer from someone's previous post, but did not find anything applicable.

Not sure if there is a bug with the Edit Environment Variable script command, if there are some conditions I'm not meeting when using that command, or if I'm simply missing something very obvious, but my attempts to use the Edit Environment Variable command to add a path to the TEMP environment variable does not yield the result I expected. Here is the window that shows the Path environment variable BEFORE I run the script command:

3849

Here is the actual script command that is being invoked:

3850

Now here is the window that shows the environment variables AFTER the script command has been invoked. I've attempted to add C:\Program Files (x86)\Material Management to the PATH environment variable. What the script command has actually done, it seems, is created another Path variable (can't believe Windows even allows that) rather than added the folder to the existing Path environment variable.

3851

Am I missing something, not using the script command correctly, found a glitch in the Matrix, or is there just a bug with the Edit Environment Variable command?

linder
07-16-2015, 01:25 PM
Hi Jerry,

No, it's not a SetupBuilder bug (SB uses the appropriate APIs to handle environment variables). Windows does this in your case.

Perhaps the following helps:

http://stackoverflow.com/questions/18804285/why-is-my-path-environment-variable-duplicated

BTW, the screenshots are from a clean Windows 7 SP1 (x64) machine -- before and after adding a value to the Path variable. No duplicate "Path". IMO, something is corrupt on your machine (e.g. caused by incorrect Registry manipulations).

Friedrich

JerryS@cat
07-17-2015, 01:19 PM
Well, I appreciate you taking the time to look at this, Friedrich. However, there's very little chance that this is happening because there is corruption on the PC I used to take those screen captures. I've tried this in my PC lab on several Windows 7 and Windows 8.1 machines -- same results. However, I also wrote another little script where the Edit Environment Variable command is the ONLY command in the script, and it seemed to work just fine in changing the PATH environment variable. So, that probably means there is something inside the other script that is causing the Edit Environment Variable command to do something other than what it was intended to do. I know it seems unlikely, but I can think of no other explanation. I've watched it in debug mode and the Edit Environment Variable command just will not add to the existing value of the PATH variable, so it creates another one although I'm at a loss as to why Windows even would allow that.

linder
07-18-2015, 06:11 AM
Jerry,

I have uploaded my test project for you and some screenshots:

http://www.lindersoft.com/projects/cat_ev.zip

It adds a "c:\cat123" folder to the PATH environment variable. Tested on Windows XP, Windows 7, Windows 8, Windows 8.1 and Windows 10. The installer always created the correct and expected registry value data for the PATH value name.

Can you manipulate the project in such a way that it "fails"?

Friedrich

JerryS@cat
07-20-2015, 10:24 AM
Your script works as expected. In regard to the Edit Environment Variable command, didn't see anything different than what I have in mine. The difference is that it still doesn't work. There must be something else in the script that is causing the problem, and I'll continue to search for it. It's frustrating because it's a straight-forward command and just not that complicated. Yet, something is causing it to add another PATH variable instead of just placing it in front of the existing PATH variable. When I look at where the environment variables are held in the registry (HKLM\System\CurrentControlSet\Control\Session Manager\Environment, there are two path values after I run my script. Very odd. Thanks for the assistance.

linder
07-21-2015, 10:39 AM
Jerry,

If you are interested, you can send your project file (and your include scripts) to support [at] lindersoft [dot] com and we'll have a look.

Friedrich