PATH does not expand environment variables #23497

Closed
opened 2026-01-31 08:43:57 +00:00 by claunia · 4 comments
Owner

Originally created by @Hafthor on GitHub (Aug 4, 2025).

Windows Terminal version

1.22.12111.0

Windows build number

10.0.26100.4770

Other Software

No response

Steps to reproduce

include a PATH directory that uses an environment variable, such as

%USERPROFILE%\AppData\Local\Microsoft\WindowsApps

attempt to invoke an executable that is in that directory, let's say winget

Expected Behavior

Environment variables should be expanded to help find executables.

Actual Behavior

Result:

'winget' is not recognized as an internal or external command,
operable program or batch file.
Originally created by @Hafthor on GitHub (Aug 4, 2025). ### Windows Terminal version 1.22.12111.0 ### Windows build number 10.0.26100.4770 ### Other Software _No response_ ### Steps to reproduce include a PATH directory that uses an environment variable, such as %USERPROFILE%\AppData\Local\Microsoft\WindowsApps attempt to invoke an executable that is in that directory, let's say `winget` ### Expected Behavior Environment variables should be expanded to help find executables. ### Actual Behavior Result: 'winget' is not recognized as an internal or external command, operable program or batch file.
claunia added the Needs-TriageIssue-BugNeeds-Attention labels 2026-01-31 08:43:58 +00:00
Author
Owner

@DHowett commented on GitHub (Aug 4, 2025):

Thanks for filing. I assume you mean "when PATH is set for my session" rather than "when I set profile.environment.PATH in my Terminal settings file", right?

If so, can you share the output of reg query HKCU\Environment /v PATH?

@DHowett commented on GitHub (Aug 4, 2025): Thanks for filing. I assume you mean "when PATH is set for my session" rather than "when I set `profile.environment.PATH` in my Terminal settings file", right? If so, can you share the output of `reg query HKCU\Environment /v PATH`?
Author
Owner

@Hafthor commented on GitHub (Aug 5, 2025):

HKEY_CURRENT_USER\Environment
PATH REG_EXPAND_SZ C:\Users\hstefansson\AppData\Local\Programs\Python\Launcher;C:\Users\hstefansson.cargo\bin;C:\Users\hstefansson\AppData\Local\Programs\Python\Python310\Scripts;C:\Users\hstefansson\AppData\Local\Programs\Python\Python310;%LOCALAPPDATA%\CloudBuild;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;C:\Users\hstefansson\AppData\Local\Programs\Microsoft VS Code\bin;%USERPROFILE%.dotnet\tools;%USERPROFILE%\utils;%USERPROFILE%\utils\sysinternals;C:\Program Files\Azure Data Studio\bin;C:\Users\hstefansson\AppData\Local\Microsoft\WinGet\Links;C:\Cygwin64\bin;%localappdata%\cf;C:\Users\hstefansson\AppData\Roaming\npm

so, for example, npm works, rustup works, but winget does not work anymore, nor does anything in my \utils dir.

@Hafthor commented on GitHub (Aug 5, 2025): HKEY_CURRENT_USER\Environment PATH REG_EXPAND_SZ C:\Users\hstefansson\AppData\Local\Programs\Python\Launcher\;C:\Users\hstefansson\.cargo\bin;C:\Users\hstefansson\AppData\Local\Programs\Python\Python310\Scripts\;C:\Users\hstefansson\AppData\Local\Programs\Python\Python310\;%LOCALAPPDATA%\CloudBuild;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;C:\Users\hstefansson\AppData\Local\Programs\Microsoft VS Code\bin;%USERPROFILE%\.dotnet\tools;%USERPROFILE%\utils;%USERPROFILE%\utils\sysinternals;C:\Program Files\Azure Data Studio\bin;C:\Users\hstefansson\AppData\Local\Microsoft\WinGet\Links;C:\Cygwin64\bin;%localappdata%\cf;C:\Users\hstefansson\AppData\Roaming\npm so, for example, `npm` works, `rustup` works, but `winget` does not work anymore, nor does anything in my \utils dir.
Author
Owner

@Hafthor commented on GitHub (Aug 5, 2025):

hmm. actually, I ran a sfc /scannow and that seemed to fix the issue. You can close the issue.

@Hafthor commented on GitHub (Aug 5, 2025): hmm. actually, I ran a `sfc /scannow` and that seemed to fix the issue. You can close the issue.
Author
Owner

@carlos-zamora commented on GitHub (Aug 6, 2025):

Glad it's working. Please let us know if it comes back. Thanks!

@carlos-zamora commented on GitHub (Aug 6, 2025): Glad it's working. Please let us know if it comes back. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#23497