Environment variable references in environment variables are not resolved with wt.exe #19722

Closed
opened 2026-01-31 06:51:48 +00:00 by claunia · 3 comments
Owner

Originally created by @anthonyvdotbe on GitHub (Apr 16, 2023).

Windows Terminal version

1.16.10262.0

Windows build number

10.0.22621.0

Other Software

No response

Steps to reproduce

  • open PowerShell and run the following 2 commands:
[Environment]::SetEnvironmentVariable('TEST_VAR1', 'foo', 'User')
[Environment]::SetEnvironmentVariable('TEST_VAR2', '%TEST_VAR1%', 'User')
  • open Windows Terminal via the start menu and run:
echo $Env:TEST_VAR2
  • open Windows Terminal via wt.exe (or Open in Terminal in File Explorer, but I assume that's the same thing) and run:
echo $Env:TEST_VAR2

Expected Behavior

The result is the same: foo.

Actual Behavior

The result is different: the first time it prints foo, the second %TEST_VAR1%.

Note there are similar open (#12545) and resolved (#12602, #11777) issues.

Originally created by @anthonyvdotbe on GitHub (Apr 16, 2023). ### Windows Terminal version 1.16.10262.0 ### Windows build number 10.0.22621.0 ### Other Software _No response_ ### Steps to reproduce * open PowerShell and run the following 2 commands: ```powershell [Environment]::SetEnvironmentVariable('TEST_VAR1', 'foo', 'User') [Environment]::SetEnvironmentVariable('TEST_VAR2', '%TEST_VAR1%', 'User') ``` * open Windows Terminal via the start menu and run: ```powershell echo $Env:TEST_VAR2 ``` * open Windows Terminal via `wt.exe` (or `Open in Terminal` in File Explorer, but I assume that's the same thing) and run: ```powershell echo $Env:TEST_VAR2 ``` ### Expected Behavior The result is the same: `foo`. ### Actual Behavior The result is different: the first time it prints `foo`, the second `%TEST_VAR1%`. Note there are similar open (#12545) and resolved (#12602, #11777) issues.
claunia added the Issue-BugResolution-Duplicate labels 2026-01-31 06:51:48 +00:00
Author
Owner

@developerA24 commented on GitHub (Apr 17, 2023):

The result is different: the first time it.

@developerA24 commented on GitHub (Apr 17, 2023): The result is different: the first time it.
Author
Owner

@zadjii-msft commented on GitHub (Apr 17, 2023):

This does sound a lot like /dup #12602. After #14999, we've made the behavior consistent with the explorer.exe launch (the "open Windows Terminal via the start menu" case) always.

@zadjii-msft commented on GitHub (Apr 17, 2023): This does sound a lot like /dup #12602. After #14999, we've made the behavior consistent with the `explorer.exe` launch (the "open Windows Terminal via the start menu" case) always.
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Apr 17, 2023):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@microsoft-github-policy-service[bot] commented on GitHub (Apr 17, 2023): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19722