Reply to Thread

Post a reply to the thread: Environment Variable question

Your Message

Click here to log in

What's the name of our main installation product (in uppercase letters), directly followed by the current year?

 

You may choose an icon for your message from this list

Additional Options

  • Will turn www.example.com into [URL]http://www.example.com[/URL].

Topic Review (Newest First)

  • 11-06-2017, 09:18 PM
    kboller

    Re: Environment Variable question

    Yes, Thanks.
  • 11-02-2017, 09:35 AM
    linder

    Re: Environment Variable question

    Hi Kurt,

    In Windows, modifications to the environment variables do not result in immediate change. For example, by default, if you start a Command Prompt after making the changes, the environment variables will reflect the previous (not the current!) values. The changes do not take effect until you log off and then log back on.

    To effect these changes without having to log off, SetupBuilder broadcasts a WM_SETTINGCHANGE message to all windows in the system, so that any interested applications can perform an update. But if an application does not handle this message, the environment variables will still reflect the previous (not the current) values.

    That is by Windows design and expected. I have created an example (please see the attached screenshots): the Command Prompt on Windows 10 (BEFORE.PNG) shows the environment variable "Path". We run a SetupBuilder installer to append "C:\yada" to the PATH variable. We display a simple Message Box so the installer does not continue. When we do again a SET in the same Command Prompt session, then PATH still has its "old" value. But when we start a new command prompt and do a SET, then you'll see the new value (AFTER.PNG).

    Does this help?

    Friedrich
  • 11-01-2017, 10:14 AM
    kboller

    Environment Variable question

    I am trying to set environment variables during an install in order to pass them to PowerShell scripts that communicate with a SQL server instance during setup. It doesn’t appear that SetupBuilder updates the environment variables at all. Here is what I found in the documentation:

    “On Windows NT-based systems, environment modification information is stored in the registry and a message notifies the system of changes when the installation completes. Any new processes, or existing processes that check for these messages, use the new or updated environment variables.”

    Does this mean that environment variables will not be updated until the SetupBuilder dialog completes? And if so, is there a way to force SetupBuilder to update the environment variables immediately so that I can pass them to my PowerShell script that checks for a specific environment variable.

    Thanks,

    Kurt

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •