@A_M As an alternative to using short paths, you can also set a value with spaces and parentheses by quoting the whole assignment
set "JAVA_HOME=C:\Program Files (x86)\Java\jre1.8.0_131"
You can also use setx
to set it as a Machine Environment variable (the value will not be reflected in the current process though, unlike using set
)
setx -m JAVA_HOME "C:\Program Files (x86)\Java\jre1.8.0_131"
or with PowerShell
[Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files (x86)\Java\jre1.8.0_131", "Machine")