如何编辑默认的系统环境变量? [英] how to edit default system environment variable ?
问题描述
如何使用regedit更改默认系统环境变量值?
i知道路径是
How to change default system environment variable value using regedit?
i know the path is
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment & HKEY_CURRENT_USER\Environment
当我查看此路径时,我发现了一些环境变量。
但是使用命令提示符SET命令它列出了一些更多的变量。
即使用命令提示符输入
Set> c:\\\ environment.txt然后它会列出一些额外的环境变量。
我需要知道额外的环境变量的位置,例如
1. ALLUSERSPROFILE
2. COMPUTERNAME
3. CommonProgramFiles
4. APPDATA
等请帮助我。
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.
推荐答案
如果在cmd控制台中使用set
命令,则此set命令仅对您当前的控制台和您从该控制台启动的其他控制台/程序。但是还有一个setx
命令,它为当前控制台窗口设置控制台变量并改变全局设置!我不能告诉你什么是支持此命令的最低Windows版本,但在我的windows7上它存在。有关setx
命令的更多信息,请打开cmd控制台并发出setx /?命令。
不要手动编辑注册表,不要浪费时间探索这些变量,因为你可以轻易地破坏你的窗口,这些值可能只能起作用在某些Windows版本上。这次投资学习有用的东西。你可以学到很多东西,所以要仔细选择!
If you use theset
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 asetx
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 thesetx
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!
正如Richard MacCutchan所说,你需要告诉我们你是什么正在努力做到。
i猜这些可能对你有帮助:
EnvironmentVariableTarget Enumeration [ ^ ]
GetEnvironmentVariable function [ ^ ]
由于您使用GetEnvironmentVariable收到的值可能不是当前值,因此最好直接从注册表中读取值
然后你可以使用RegOpenKeyEx(...)和RegQueryValueEx(...)函数
也 MSDN示例 [ ^ ]显示一些代码。
hope这有帮助。
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 .
这篇关于如何编辑默认的系统环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!