0

I want to modify the User Path variable, let's say with "C:\Program Files\Sublime Text 3", which contains subl.exe, so I can use subl in a command prompt. I cannot modify the system environment path, so I have to do it via the user environment path.

Using setx I could modify the User path variable, if I type echo %path% it shows me that the path to subl was added to the variable, same when I go to 'Edit the user environment variables'. However, still neither subl nor subl.exe are recognized commands.

Following the second answer here, I see that on my pc, the type of Path is "REG_SZ" instead of "REG_EXPAND_SZ", could that be the problem? If so, how can I change that type? If I right-click on the variable and select "Modify", it only gives me the name and the value, but not the type.

I already restarted my pc, also in an administrator-prompt added paths aren't recognized.

Any help would be appreciated!

EDIT: Thanks for the suggestions, echo %path% returns something of the form path1;path2;path3";path1;path2;path3;, those double quotation marks are breaking it I suppose.

3
  • I assume you have closed the command prompted and reopened it after you change the variable? I assume you have ran the command to modify the variable in an elevated command prompt? – Ramhound Dec 15 '20 at 17:10
  • Showing your existing path as seen by "echo %PATH%" from the command prompt might also help. – Señor CMasMas Dec 15 '20 at 18:56
  • Please don't edit your question to include the answer, answer your own question. Please read Can I answer my own question? – DavidPostill Dec 19 '20 at 12:47
0

First, do not change the Registry type of a system variable; that is not the issue. [On my PC, User Path is REG_SZ and System Path is REG_EXPAND_SZ.]

Second, is there an invalid entry in the path, prior to the addition for subl? Parsing of the Path variable stops after an invalid entry.

Third, why not modify the PATH using the GUI? If you need to do that repeatedly, just open Regedit and export HKEY_CURRENT_USER\Environment and run the .reg file when needed.

3
  • Thanks for the suggestion, I took a closer look when echoing the variable, I noticed it looks (rather oddly) like this: path1;path2;path3";path1;path2;path3; I suppose the double quotation marks are breaking it. – Pj0tr77 Dec 15 '20 at 18:56
  • @Pj0tr77 - Please provide us the exact output. There shouldn't be any reason we should be left guessing. We cannot diagnose the issue otherwise. – Ramhound Dec 15 '20 at 19:07
  • @Ramhound You're right, sorry, I'll do so if there comes a next time – Pj0tr77 Dec 15 '20 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.