Skip to content

docs: stop copying machine PATH into user PATH in Windows CLI install - #1993

Open
jato-c8y wants to merge 1 commit into
loft-sh:mainfrom
jato-c8y:fix/windows-install-user-path
Open

docs: stop copying machine PATH into user PATH in Windows CLI install#1993
jato-c8y wants to merge 1 commit into
loft-sh:mainfrom
jato-c8y:fix/windows-install-user-path

Conversation

@jato-c8y

@jato-c8y jato-c8y commented Aug 26, 2026

Copy link
Copy Markdown

The snippet persisted $env:Path to the user scope. $env:Path is the machine and user PATH already merged, so every run copied the whole machine PATH into the user's PATH, and re-running grew it again. Those frozen copies then shadow later machine-PATH changes.

Read the user PATH from HKCU\Environment unexpanded instead, append the devpod directory, and write it back as REG_EXPAND_SZ so every other entry survives byte-for-byte. Skip the write when the entry is already present.

GetEnvironmentVariable('Path','User') is not a usable source: it expands %VAR% on read, and SetEnvironmentVariable stores REG_SZ, so together they flatten dynamic entries such as %JAVA_HOME%\bin and the default %USERPROFILE%\AppData\Local\Microsoft\WindowsApps into fixed paths.

The final SetEnvironmentVariable on an unused variable is a no-op write whose only purpose is the WM_SETTINGCHANGE broadcast. A direct registry write does not emit one, so without it the new PATH would not reach new terminals until the next logon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant