After modifying systems env var "Path", how to broadcast it?
Posted: Sun Jan 21, 2018 6:04 pm
Hi,
I'd like to edit edit environment variables, e.g. the systems "Path" variables
(by reading the ones to append from an .ini file and writing the new combined
one into the registry). Ofc my .exe is started with the appropriate admin permissions
to be able to write to HKLM.
All these things are working fine so far, but what is missing is the ability to
broadcast this variable change so that a newly opened command prompt
would show the changes variables when "set" is executed.
I've tried it with:
but this doesn't cut it...
The only way (and this is what I want to avoid!) is to open the the belonging window
Control Panel - System and Security - System - Advanced system settings - Environment Variables...
and hit the OK button.
Then a "set" in a new command prompt will show the changes...
It does work fine when I do this with the users "Path" env variable, but it does not
work with the systems "Path" env var...
I'd like to edit edit environment variables, e.g. the systems "Path" variables
(by reading the ones to append from an .ini file and writing the new combined
one into the registry). Ofc my .exe is started with the appropriate admin permissions
to be able to write to HKLM.
All these things are working fine so far, but what is missing is the ability to
broadcast this variable change so that a newly opened command prompt
would show the changes variables when "set" is executed.
I've tried it with:
Code: Select all
Define.s lParam = "Environment"
SendMessage_(#HWND_BROADCAST, #WM_SETTINGCHANGE, 0, @lParam)
The only way (and this is what I want to avoid!) is to open the the belonging window
Control Panel - System and Security - System - Advanced system settings - Environment Variables...
and hit the OK button.
Then a "set" in a new command prompt will show the changes...
It does work fine when I do this with the users "Path" env variable, but it does not
work with the systems "Path" env var...