How to add to SYSTEM "PATH" environment variable in windows 10 via cmd, not to user's one?

1

By using setx "%path%;c:\whateverFolder I just copy system path variable to users one, therefore duplicating it, and only after it the required folder is added. Is it possible to add it to SYSTEM path variable. not to the users path and if it is, how can I do it?

ymdred16

Posted 2019-06-25T08:19:59.050

Reputation: 53

1

There is the /M switch of setx. However, setx limits strings to a length of 1024 bytes, which might not be enough; and, even worse, %PATH% holds a concatenation of user and system PATH variables, so setx totally messes messes up with them; take a look at this answer on StackOverflow...

– aschipfl – 2019-06-25T08:58:01.730

Answers

1

You can still use the setx command, by adding the /m parameter:

/m  Specifies to set the variable in the system environment. The default setting is the local environment.

Like this:

setx /M path "%path%;C:\your\path\here\"

harrymc

Posted 2019-06-25T08:19:59.050

Reputation: 306 093