我正在为各种项目在不同的 Java SDK(1.4.2、1.5.0 和 1.6.0)之间切换。我想在我的 Windows XP 机器上设置 JAVA_HOME 环境变量,而无需经过繁琐的我的电脑 -> 高级 -> [选择系统变量] -> 编辑 -> 确定 -> 确定
是否可以从命令行执行此操作,或者是否有可以执行此操作的实用程序?
(请注意,我指的不是标准批处理文件“SET”命令 - 我想“全局”设置环境变量,而不仅仅是在控制台窗口的生命周期内)。
最佳答案
来自 http://vlaurie.com/computers2/Articles/environment.htm :
Using the add-on tool Setx.exe
It is not part of the standard Windows XP setup but a command-line tool called setx.exe is included in the Windows XP Service Pack 2 Support Tools. This tool extends the set command so that permanent changes in the environment variables can be made. For example, to add a folder C:\New Folder to the path, the command would be setx path "%PATH%;C:\New Folder"
关于windows - 如何在不使用 "My Computer"对话框的情况下在 Windows XP 中设置系统环境变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/331862/