Hi Support Team,
my MSI script contains the following command:
~InstallAware Clipboard Data~
~Set Environment~
~{2319A370-12EC-4DE9-99AA-DD08C2C8ED4D}~
~MY_ROOT~
~$TARGETDIR$~
~0~
~2~
~TRUE~
~TRUE~
After Setup has finished I open a command prompt (cmd.exe) and enter 'set'. MY_ROOT is not listed.
When I run cmd elevated it is.
After restart the environment variable MY_ROOT is also visible to non elevated processes.
I assume that something like a change notification is missing, because after a manual change of the System variable MY_ROOT via windows the variable is visible to non elevated processes without the Need for a reboot.
Best regards
Michael
Set Environment Variable does not work
-
- Posts: 41
- Joined: Mon Apr 13, 2009 8:58 am
-
- Posts: 41
- Joined: Mon Apr 13, 2009 8:58 am
Re: Set Environment Variable does not work
FYI: I work around this by invoking the following API call at the end of my script:
SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, Integer(PChar('Environment')));
SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, Integer(PChar('Environment')));
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Set Environment Variable does not work
Dear Michael,
yes, this can be a possible workaround in your case ... otherwise in other circumstances, it may be necessary a system restart.
You may find interesting a similar discussion I had some time ago.
http://www.installaware.com/forum/viewtopic.php?f=2&t=9515
Regards
yes, this can be a possible workaround in your case ... otherwise in other circumstances, it may be necessary a system restart.
You may find interesting a similar discussion I had some time ago.
http://www.installaware.com/forum/viewtopic.php?f=2&t=9515
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
-
- Posts: 41
- Joined: Mon Apr 13, 2009 8:58 am
Re: Set Environment Variable does not work
Hi Francesco,
Obviously other users suffer from the same issue.
I've created a DLL with two exported functions. They are called WITHOUT admin rights ('non elevated' by means of "Run Program under UAC") in the Finish Setup Region.
The first one (the already mentioned SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, Integer(PChar('Environment')));) makes the Environment changes immediately effective.
The second one (Delphi code: SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil);) repairs the Icon Cache to work arould the problem that replaced executables with a different / changed icon keep show the old icon (e.g. in desktop links).
From my point of view the IA Setup should invoke this commands itself (the latter one probably only in case environment variables has been set during setup/uninstall) to ensure a proper configuration without the need to reboot / relogin.
This way you can get rid of this issue forever...
Best regards
Michael
Obviously other users suffer from the same issue.
I've created a DLL with two exported functions. They are called WITHOUT admin rights ('non elevated' by means of "Run Program under UAC") in the Finish Setup Region.
The first one (the already mentioned SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, Integer(PChar('Environment')));) makes the Environment changes immediately effective.
The second one (Delphi code: SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil);) repairs the Icon Cache to work arould the problem that replaced executables with a different / changed icon keep show the old icon (e.g. in desktop links).
From my point of view the IA Setup should invoke this commands itself (the latter one probably only in case environment variables has been set during setup/uninstall) to ensure a proper configuration without the need to reboot / relogin.
This way you can get rid of this issue forever...
Best regards
Michael
Who is online
Users browsing this forum: No registered users and 132 guests