In environment variables, I have a PATH variable for both user variables and system variables.
In the script package, so that I can add the PATH user variable with the new path given, I need to select the current value. Unfortunately,% PATH% returns a combination of a user variable and a system variable.
Of course, I want to add a new user path value to the user variable. There is no point also improving it using the system path. That is why I have 2 variables.
Thanks in advance.
Edit: the documentation contains the following statement:
The% PATH% variable is set by both the system and user variables, the values of 2 are combined to give PATH for the current user.
Example:
User Variables:
PATH value: c:\dev
System variables
PATH value: c:\Program Files
What I want to do is add a value to the user variable: c: \ tmp, so at the end of PATH it will have the value: c: \ dev; c: \ tmp
But if you open the cmd window:
echo %PATH% c:\Program Files;c:\dev
therefore setx will do the following
setx path "%path%;c:\tmp"
open new cmd
echo %PATH% c:\Program Files;c:\dev;c:\tmp
And this is wrong because I only need c: \ dev; c: \ tmp
Hope this time I was more clear.
source share