Click here to Skip to main content
15,912,977 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to change default system environment variable value using regedit?
i know the path is
C++
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment & HKEY_CURRENT_USER\Environment


when i check this path i found some of the environment variables.
but using command prompt "SET" command it list some more varables.
ie type using command prompt
"Set > c:\environment.txt" then it will list some extra environment variables.
I need to know location of that extra environmet varibles such as
1. ALLUSERSPROFILE
2. COMPUTERNAME
3. CommonProgramFiles
4. APPDATA


etc. pleasehelp me.
Posted
Updated 5-Apr-13 23:48pm
v2
Comments
Richard MacCutchan 6-Apr-13 8:26am    
That is correct, the set command lists all variables currently available in the command window environment. However, you have not clearly explained what you are trying to do.

If you use the set command in a cmd console then this set command has effect only on your current console and the other consoles/programs that you start from that console. BUT there is a setx command too that sets the console variable for the current console window and alters the global settings too!!! I can not tell you what is the lowest windows version that supports this command but on my windows7 it is present. For more on the setx command open a cmd console and issue the "setx /?" command.

Don't edit the registry manually and don't waste your time exploring these variables as you can easily wreck your windows and the values may work only on some windows versions. Invest this time in learning something useful. There are an infinite number of things you can learn so choose from them carefully!
 
Share this answer
 
v2
hi,
as Richard MacCutchan has said, you need to tell us what you are trying to do.
i guess these might help you :
EnvironmentVariableTarget Enumeration[^]
GetEnvironmentVariable function[^]

Since the values you receive with GetEnvironmentVariable may not be the current ones it'll be better to read the values directly from the registry
then you might use RegOpenKeyEx(...) and RegQueryValueEx(...) functions

also MSDN Examples[^] shows some code .

hope this helps .
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900