Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

API for Windows Environment

Posted on 1998-11-19
4
221 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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 viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

856 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