Introduction
pcset.exe is very similar to Microsoft's resource kit utility setx.exe with regards to create persistent Operating system environmental
variables. (although setx can do more).
System environment variables are stored in the registry:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment.
By creating a new value by calling the RegSetValueEx
function. To remove a value
we call the RegDeleteValue
function.
To effect these settings without logging off, we
broadcast a WM_SETTINGSCHANGE
massage to all windows in the system, so that apps
like Control Panel, Task Manager, etc. can perform an Update.
I wrote this utility for two reasons -
- see if I can write
a environment utility to set persistent (system) environment variables. (Microsoft's native set.exe cannot create persistent variables)
- My work ask me to script an remote / automated firewall backup script. - because
clients remote and Checkpoint firewall-1
has not been set up properly - the environment variables are not set at all and
our script reference a %fwdir% variable to see where the firewall is
installed!