我无法理解为什么会收到此错误:
ERROR: Invalid syntax. Default option is not allowed more than '2' time(s).
Type "SETX /?" for usage.
实施
C:\Users>setx JAVA_HOME "C:\DOC\JDK64\1.8.0.74"
SUCCESS: Specified value was saved.
C:\Users>setx PATH "%PATH%;%JAVA_HOME%\bin"
ERROR: Invalid syntax. Default option is not allowed more than '2' time(s).
Type "SETX /?" for usage.
C:\Users>setx PATH "%PATH%;%JAVA_HOME%bin"
ERROR: Invalid syntax. Default option is not allowed more than '2' time(s).
Type "SETX /?" for usage.
这很简单,但隐藏。运行setx /?我想答案就在那里。您作为参数(字符串)提供的PATH包含空格。您应该将PTH括在“”之间。