• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

API for Windows Environment

is there an API for modifying windows environment variables
(e.g. classpath)
0
mickeydog
Asked:
mickeydog
  • 2
  • 2
1 Solution
 
jkrCommented:
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
 
mickeydogAuthor Commented:
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
 
jkrCommented:
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
 
mickeydogAuthor Commented:
ok, thanks!

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now