I am trying to write a batch file running under Windows 8 and Server 2012 R2 where I append a variable to the PATH. The problem is when I use setx, it adds the VALUE of the variable to the path instead of adding the variable itself.
Example: (These of course are not real, only for this example)
My path is C:\Windows
My variable %VAR_1% is set to C:\Windows\system32
If I type in this command:
setx PATH "%PATH%";"%VAR_1%" /M
then what I would expect my PATH to be:
C:\Windows;%VAR_1%;
But instead the PATH becomes:
C:\Windows;C:\Windows\System32;
So the issue is the setx command is adding the value of the variable, instead of the variable itself to the PATH. I've searched on this site (and others), and I've not found the answer to this.
Is there a way to do this with setx?
I've heard there are other tools that can be used for this, but I need to do this with whatever built in tools Windows 8 / Server 2012 R2 has because I would be pushing this batch file to hundreds of computers and I don't want to have to send each user little tool as well.