[BUG]: Path env variable does not function properly with USERPROFILE environment variable #21311

Closed
opened 2026-01-31 07:39:30 +00:00 by claunia · 3 comments
Owner

Originally created by @Haiderahandali on GitHub (Feb 25, 2024).

Windows Terminal version

1.18.10301.0

Windows build number

Microsoft Windows [Version 10.0.22631.3155]

Other Software

The issue happens as well in conhost

Steps to reproduce

please watch the attached video, I am not sure how to reproduce it on others machines:

https://github.com/microsoft/terminal/assets/53301143/356f9f48-e453-4a93-aab1-d2cec91e8c40

Expected Behavior

To work the same way it works with absolute path (if I replace USERPROFILE with my User's name, it works)

Actual Behavior

The PATH env does not seem to recognize Paths with %USERPROFILE% insides them.

Originally created by @Haiderahandali on GitHub (Feb 25, 2024). ### Windows Terminal version 1.18.10301.0 ### Windows build number Microsoft Windows [Version 10.0.22631.3155] ### Other Software The issue happens as well in conhost ### Steps to reproduce please watch the attached video, I am not sure how to reproduce it on others machines: https://github.com/microsoft/terminal/assets/53301143/356f9f48-e453-4a93-aab1-d2cec91e8c40 ### Expected Behavior To work the same way it works with absolute path (if I replace USERPROFILE with my User's name, it works) ### Actual Behavior The PATH env does not seem to recognize Paths with %USERPROFILE% insides them.
claunia added the Needs-TriageIssue-BugNeeds-Attention labels 2026-01-31 07:39:30 +00:00
Author
Owner

@Haiderahandali commented on GitHub (Feb 25, 2024):

I forgot to add, it is consistent after every reboot.

@Haiderahandali commented on GitHub (Feb 25, 2024): I forgot to add, it is consistent after every reboot.
Author
Owner

@lhecker commented on GitHub (Feb 25, 2024):

It's likely an issue with the registry, since conhost does not modify the environment block in any way. For now, could you try running this powershell script? https://gist.github.com/lhecker/393252fb1e95b3bc118d40ace802a505
It lists any environment registry values that have embedded \0 characters. If it doesn't list anything I'll try to modify the script to do more sanity checks. Let me know if you have any questions!

Edit: Someone (I'm not sure whether they would want to be mentioned here) on Discord pinged you with the excellent point that you're using %USERPROFILE% in the system environment variables section and not the user one (= placeholder cannot be resolved until login). Be sure to try out whether that fixes your issue! Please feel free to close this issue if it did. 🙂

@lhecker commented on GitHub (Feb 25, 2024): It's likely an issue with the registry, since conhost does not modify the environment block in any way. For now, could you try running this powershell script? https://gist.github.com/lhecker/393252fb1e95b3bc118d40ace802a505 It lists any environment registry values that have embedded \0 characters. If it doesn't list anything I'll try to modify the script to do more sanity checks. Let me know if you have any questions! Edit: Someone (I'm not sure whether they would want to be mentioned here) on Discord pinged you with the excellent point that you're using `%USERPROFILE%` in the system environment variables section and not the user one (= placeholder cannot be resolved until login). Be sure to try out whether that fixes your issue! Please feel free to close this issue if it did. 🙂
Author
Owner

@Haiderahandali commented on GitHub (Feb 26, 2024):

indeed, that solves the issue.

@Haiderahandali commented on GitHub (Feb 26, 2024): indeed, that solves the issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21311