Solved

API for Windows Environment

Posted on 1998-11-19
4
218 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
ok, thanks!

0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

763 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

9 Experts available now in Live!

Get 1:1 Help Now