Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update system PATH variable permanently from cmd?

Tags:

path

windows

cmd

We can use setx as discussed here.

setx PATH "%PATH%;C:\Something\bin" 

But this command can just make changed to user PATH variable not the system one.

How can we make a similar system wide command?

enter image description here

like image 955
Nam G VU Avatar asked Jun 14 '14 11:06

Nam G VU


People also ask

How can I set Java PATH permanently in CMD?

2) How to set Permanent Path of JDK in Windows For setting the permanent path of JDK, you need to follow these steps: Go to MyComputer properties -> advanced tab -> environment variables -> new tab of user variable -> write path in variable name -> write path of bin folder in variable value -> ok -> ok -> ok.


1 Answers

Type setx /? to get basic command help. You'll easily discover:

/M                     Specifies that the variable should be set in                        the system wide (HKEY_LOCAL_MACHINE)                        environment. The default is to set the                        variable under the HKEY_CURRENT_USER                        environment. 

You need to run this from an elevated command prompt. Right-click the cmd shortcut and select Run as Administrator.

E.g.

setx /M PATH "%PATH%;C:\Something\bin" 

Caution:

We may destroy the current system's PATH variable. Make sure you backup its value before you modify it.

like image 178
Hans Passant Avatar answered Oct 07 '22 07:10

Hans Passant