Adding serviceman to PATH doesn't work in Windows. #1

Open
opened 4 years ago by josh · 2 comments
josh commented 4 years ago

Windows 10 v1903.

What I did:

mkdir %userprofile%\bin
move serviceman.exe %userprofile%\bin\serviceman.exe
reg add HKEY_CURRENT_USER\Environment /v PATH /d "%PATH%;%userprofile%\bin"

Opened new command prompt, ran serviceman, got:

'serviceman' is not recognized as an internal or external command,
operable program or batch file.
Windows 10 v1903. What I did: ``` mkdir %userprofile%\bin move serviceman.exe %userprofile%\bin\serviceman.exe reg add HKEY_CURRENT_USER\Environment /v PATH /d "%PATH%;%userprofile%\bin" ``` Opened new command prompt, ran `serviceman`, got: ``` 'serviceman' is not recognized as an internal or external command, operable program or batch file. ```
Owner

I should update the README.

reg updates the registry, it DOES NOT update the PATH in the current environment.

Getting Windows to re-read the PATH from the registry into the environment requires a restart, or a program to issue a special low-level syscall function that causes PATH to be re-read.

And that is why I created pathman, which does use that low-level syscall:
https://git.rootprojects.org/root/pathman

P.S. The built-in setx command will cause PATH to be re-read, but it has a long-standing bug that causes the PATH to be set in the wrong place, and potentially truncated... welcome to Windows :)

I should update the README. `reg` updates the registry, it DOES NOT update the `PATH` in the current environment. Getting Windows to re-read the PATH from the registry into the environment requires a restart, or a program to issue a special low-level `syscall` function that causes `PATH` to be re-read. And that is why I created `pathman`, which does use that low-level syscall: https://git.rootprojects.org/root/pathman P.S. The built-in `setx` command will cause PATH to be re-read, but it has a long-standing bug that causes the PATH to be set in the wrong place, and potentially truncated... welcome to Windows :)
Poster

Ok. Yeah. Windows is weird :)

Ok. Yeah. Windows is weird :)
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.