Solved

API for Windows Environment

Posted on 1998-11-19
4
219 Views
Last Modified: 2010-04-01
is there an API for modifying windows environment variables
(e.g. classpath)
0
Comment
Question by:mickeydog
  • 2
  • 2
4 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 50 total points
ID: 1178257
Yes, the name is 'SetEnvironmentVariable()'. The only problem is that it's only valid for the current process (and processes that are created by the current one). If you want them to persist, you'll have to add them to the user's environment (different for NT & Win9x)
0
 

Author Comment

by:mickeydog
ID: 1178258
in particular, i will need to set CLASSPATH.
i wanted to set it when installing my software.
so it would seem that i would want them to persist.
this would be in windows NT.

do you know how this is accomplished?

0
 
LVL 86

Expert Comment

by:jkr
ID: 1178259
Yes (NT is easier than 9x ;-). Simply add a value to 'HKEY_CURRENT_USER\Environment' supplying the variable's name as the value name. If you want to set the value for all users, you should add this value to 'HKEY_USERS\<some SID to be replaced>\Environment'
0
 

Author Comment

by:mickeydog
ID: 1178260
ok, thanks!

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C++ - Convert a wString to char * 9 513
how to understand recursion 12 218
returning a dereferenced pts in C++ 10 141
Create a path if not exists 7 69
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now