Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Placing the semicolon in the Windows PATH environment variable

Where should the trailing semicolon in the Windows PATH environment variable be placed when adding a new folder?

Is it

  • [oldPATH];C:\My Folder
  • [oldPATH]C:\My Folder;
  • [oldPATH];C:\My Folder;

?

I saw different practices.

like image 580
Christian Troester Avatar asked Jan 16 '23 04:01

Christian Troester


1 Answers

This is not really a syntax thing, actually. The correct answer here is: Place the semicolon so the result is a valid PATH.

This usually means one of the following:

set PATH=%PATH%;C:\Foo\Bar
set PATH=C:\Foo\Bar;%PATH%

because usually PATH doesn't end in a semicolon, so you have to add one appropriately to not mangle an existing path in it.

Just look at how PATH looks like and consider what you need to do if you add another path. This means you have to add a separator (the semicolon) and the path itself.

like image 75
Joey Avatar answered Jan 31 '23 07:01

Joey