I have a bizarre problem with setting my user PATH variable. C:\Program Files\ghcup\bin is the path to my executable that I want to add to my user PATH.
I have tried setx /M path "%PATH%;C:\Program Files\ghcup\bin" using the administrator command prompt. This correctly sets the path for the administrator so when I run echo %PATH% from my administrator command prompt, C:\Program Files\ghcup\bin does show up. Everything works fine so long as I'm running the executable from my administrator command prompt.
However, the problem I have is that my user PATH is not set.
I have tried using the GUI to set my user PATH. The path appears to be set in in the GUI, but it doesn't show up when I run echo %PATH% from my user command prompt.
When I try to run the executable from my user command prompt, I continue to get the following error message: 'ghci' is not recognized as an internal or external command, operable program or batch file.
I have read this post which tackles the same problem and I have checked for incorrect paths and that my PATH variable Registry is REG_SZ.
11 Answer
You can set environment variables from Windows Command Prompt using the set or setx command. The set command only sets the environment variable for the current session. The setx command sets it permanently, but not for the current session. If you want to set it for current as well as future sessions, use both setx and set.
here you have more details:
4