Tuesday, 5 February 2019

command line - Setting environment variables and appending to system-wide %PATH% with a Windows batch file

I'm trying to set three environment variables and append them to the machine path. Right now my code is like this:


setx CATALINA_HOME "C:\Program Files (x86)\Apache Software Foundation\Tomcat 7" /m
setx JRE_HOME "C:\Program Files (x86)\Java\jre7" /m
setx JAVA_HOME "C:\Program Files (x86)\Java\jdk1.7.0_21" /m
setx PATH "%PATH%;%JAVA_HOME%\bin;%JRE_HOME%\bin;%CATALINA_HOME%\BIN;" /m

The first three when run alone work fine for adding the variable. However, the last line is resulting in the deletion of part of the original path and none of the additional variables appended.


My desired result would be the addition of the three variables and for the system-wide path to be


[original path];%JAVA_HOME%\bin;%JRE_HOME%\bin;%CATALINA_HOME%\BIN;

No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...