5

I mistakenly deleted the entire PATH variable under System Variables. So I tried to add a variable named PATH explicitly, to the System Variable. But now whenever I try to add multiple PATHs, each PATH overwrites the previous one.

Screenshot 1

As you can see, instead of opening the list of paths, it just gives the option of one path. So I tried to append a PATH variable using command line.

setx path "D:\Softwares\MongoDB\bin" /m

Screenshot 2

It still overwrites the previous path. As shown, the Java path(from Screenshot 1) got overwritten by the MongoDB path.

How do I resolve this issue ? How do I add multiple paths to the PATH variable ?

P.S - I use Windows 10 (64 bit).

0

4 Answers 4

9

You can add each of the PATH values you require and separate them with semi-colons

Sign up to request clarification or add additional context in comments.

1 Comment

Just what I need it, for anyone looking to have the Java Keytool and Flutter doctor at the same time this works like a charm, thanks Gicheha!
3

I have found the solution to this problem and posting this as a reference for anyone in future who deletes their PATH variable entirely.

  1. Open run.(Press Window Key + R)

  2. Type regedit.

  3. Navigate through HKEY_LOCAL_MACHINE -> SYSTEM -> ControlSet001 -> Control Session Manager -> Environment

  4. There will be a PATH variable. If not, create a variable and name it Path.

  5. Enter all your paths each seperated by a semi-colon. For example - D:\Softwares\Java\bin;D:\Softwares\MingW\bin;D:\Softwares\MongoDB\bin;

Comments

1

I just discovered that if you do add more than one path separated by a semi-colon on the single-interface and close the window, the next time you edit the variable it will display it with the multi-path options like you had with the Path variable.

Note that you have to manually add the additional path after the semi-colon in the one-line interface. That is, you can't use the "Browse" button, it will just overwrite your first path.

Comments

0

Try like this:

setx path "%path%;D:\Softwares\MongoDB\bin" 

This will append the path to original path variable. Here your mistake was you weren't appending the new path to the PATH variable but just overwriting it.

2 Comments

It did not work. The path got added to User Variables, not System Variables.
WARNING!!! Don't use setx it will truncate your path if it's more than 1024 characters here's a better powershell alternative stackoverflow.com/a/37304698/17193072

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.