Click here to Skip to main content
15,888,351 members
Articles / Programming Languages / C++
Article

PerfeCt Set (pcset.exe)

Rate me:
Please Sign up or sign in to vote.
2.33/5 (3 votes)
23 Apr 2002 56.8K   1.2K   17   6
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


Written By
Web Developer
South Africa South Africa
I am an IT security consultant that focuses mainly in Oracle, Microsoft, Citrix, RSA, SUN, and Linux security. What I do is Perimeter security design (firewalls, IDS etc) as well as internal / external network assessments (penetration).

On the programming side I’m sellable on VC++. I’m also strong using c# (asp.net) TSQL, VC++.Net, STL, COM, ATL, Java/VBscript / Coldfusion /

Home page: http://www.starbal.net

Comments and Discussions

 
GeneralVery Poor example Pin
Tom Wright30-Aug-05 12:35
Tom Wright30-Aug-05 12:35 
GeneralRe: Very Poor example Pin
nums30-Aug-05 20:56
nums30-Aug-05 20:56 
GeneralRe: Very Poor example Pin
Tom Wright31-Aug-05 3:53
Tom Wright31-Aug-05 3:53 
GeneralRe: Very Poor example Pin
Tom Wright31-Aug-05 4:01
Tom Wright31-Aug-05 4:01 
GeneralRe: Very Poor example Pin
nums31-Aug-05 6:46
nums31-Aug-05 6:46 
GeneralWinNT only Pin
Philippe Lhoste6-Dec-02 4:47
Philippe Lhoste6-Dec-02 4:47 
AFAIK, this won't work for Win9x, where persistent environment variables are set in the AutoExec.bat file...
Nothing wrong with that, but you should update the system listing on top of the article, and state this clearly on the article itself.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.