Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

PerfeCt Set (pcset.exe)

0.00/5 (No votes)
23 Apr 2002 1  
Create persistent SYSTEM environment variables

Sample Image - pcset.gif

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 -

  1. see if I can write a environment utility to set persistent (system) environment variables. (Microsoft's native set.exe cannot create persistent variables)
  2. 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!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here