i want to modify "Path" Enviornmant Variable through Msi installshield
i want to install apache tomcat on target machine and i need to modify Windows "Path" Environment variable , how can i do?
use SetEnvironmentVariableA for the current session and if you need to get it updated permanently then set it in registry (SYSTEM\\ControlSetControl\\Session Manager\\Environment) and broadcast the same using SendMessage function.
You could also use the Environment Variables view, which uses MSI's Environment table and related actions, to append something to PATH. The view is under System Configuration, and the help topic "Environment Variables View" has details.
Issues with broadcasting the updated environmental variable
I am using pure installscript project and there is not option for Environmental variables view.
We are still doing it from installscript code, it works on Win 7 ,but it hangs on Windows 10 machine. It hangs at the point,after setting the environment variable related registry key and try broadcasting the change to all child processes.
I tried replacing with SendMessageTimeout, so as to overcome hang issue, but at end of install, I see registry key updated with new env variable, but all other child processes not reflecting the new env var until we do system restart
szEnv = "Environment";
pEnv = &szEnv;
//Takes more time on Windows 10
//SendMessage (HWND_BROADCAST, WM_WININICHANGE, 0, pEnv );
if(!SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, pEnv, SMTO_ABORTIFHUNG, SMTO_TIMEOUT, pResult))then
LogInformation("SendMessageTimeout failed in RefreshEnvironment, Error :" + Err.LastDllError());
Is there any other way to forcefully get all child processes to reflect new environmental variable without doing a system restart?
Originally Posted by RobertDickau
You re replying to Robert Dickau, but he has not logged on here since December of 2013, about 4 years ago.
Also, just so you know, Flexera no longer provides support for Installshield 2012. or 2012 Spring. You must be on at least 2013 to get support.
InstallScript only projects are very outdated. Everyone should be compiling to an MKSI these days. The old Setup.exe and InstallScript only is only maintained for backward compatibility.
You might have better luck if you use something more modern on Windows 10. The InstallShield 2012 precedes Windows 10 by a few years. It does not surprise me if anyone has difficulties.
Try something modern.
Tags for this Thread