I have an MSI install program for my application, that writes something to the path environment variable, but is is not "refreshed" in Windows until I reboot or manually go into environment variables and click ok.
My client has requested that we fix this.
The install program is limited but I have the option to run a batch file or VBScript after installation is finished.
Anybody know if there is a command or a function I can use?
If restart is not an option, you can try to kill every instance of explorer.exe, but i think this will also be not acceptable.
The correct way of doing it is sending a message to all top most windows to notificate of changes in the environment. But i don't know anything in the OS to do that. If you can include an exe and have access to a c compiler, this should do the trick
#include "windows.h"
void main(void) {
SendMessageTimeout(
HWND_BROADCAST,
WM_SETTINGCHANGE,
(WPARAM) NULL,
(LPARAM) "Environment",
SMTO_NORMAL,
1000,
NULL
);
}
I've tried compiling it with mingw/gcc in Windows 7 64 and seems to work without problems.