[英]Windows add to path from command line
When using Boxstarter and or Chocolatey it is difficult to install JDK properly to use with Maven and other tools. 使用Boxstarter和/或Chocolatey时,很难正确安装JDK以便与Maven和其他工具一起使用。
How can I add to environmental variables? 如何添加环境变量?
setx -m path "C:\java"
but this will clear previous environmental variable. 但这将清除以前的环境变量。
Suggesing this was a duplicate:I said I wanted "add" to the ev's not "set" and I was clearly looking for a cmd script 暗示这是重复的:我说我想向ev的“添加”而不是“设置”,我显然在寻找一个cmd脚本
You should add new path to end of current path with this: 您应该使用以下命令将新路径添加到当前路径的末尾:
setx /M PATH "%PATH%;<your-new-path>"
So in your case it will be like this: 因此,在您的情况下,它将是这样的:
setx /M PATH "%PATH%;C:\java"
This is my Powershell append test suggestion. 这是我的Powershell附加测试建议。 Note the limitation of Windows previous to Windows 10.
请注意Windows 10之前的Windows的限制。
Windows 8- WARNING: The data being saved is truncated to 1024 characters. Windows 8-警告:正在保存的数据被截断为1024个字符。
Powershell -Command " setx -m pathtest \\"$env:path ";" $env:JAVA_HOME\\""
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.