View Full Version : How to get rid of the last slash in the environment variable

07-27-2005, 03:24 PM
I have a Basic MSI project and need to set Environment variable using System Configuration->Environment variable option. In my Setup script I am getting my property value and set it with the MsiSetProperty function after getting rid of the last slash. I understand that If I use this function I can use this variable after my script ran? Is this correct?
Still when I set environment variable IS uses default value and not the one I set in my script.
What am I missing?

07-28-2005, 05:23 PM
What is the name of the property you're writing to the environment variable? When are you changing the value? Does a log file tell you anything?

07-29-2005, 10:41 AM
The name of the property is INSTALLDIR. In my Setup script I get the property via MsiGetProperty, strip the last slash and put in the INSTALLDIR_NO_SLASH property via MsiSetProperty. My setup script runs well before WriteEnvironmentStrings function in a Execute sequence.
In my System Configuration->Environment Variables I put [INSTALLDIR_NO_SLASH] in a value property. When my application runs instead of the install dir value set by the user I see my default value (C:\ which is the default in the Property Manager Table).
Log file shows only: ReturnEnvironmentStrings return value 1.


07-29-2005, 11:24 AM
Does the MsiSetProperty return value tell you anything? Are you setting the _NO_BACKSLASH property during immediate mode? Does a test message box in the script show the correct value?

07-29-2005, 12:25 PM
Yep, that's the problem my function was in the deferred execution mode. It need's to be in the immidiate mode to be set correctly.
Thanks a lot.