New tabs don't launch in the directory of the first tab when launching WT via cmd.exe shorthand #19289

Open
opened 2026-01-31 06:39:07 +00:00 by claunia · 1 comment
Owner

Originally created by @Pieter-Dewachter on GitHub (Jan 30, 2023).

Windows Terminal version

1.15.3466.0

Windows build number

10.0.22621.1105

Other Software

No response

Steps to reproduce

Reproduce actual (broken) behaviour:

  1. When in a particular folder with Explorer, open Terminal by typing "cmd" in the address bar
  2. Create a new tab in the opened Terminal window

Reproduce expected behaviour:

  1. When in a particular folder with Explorer, open Terminal by typing "wt" in the address bar
  2. Create a new tab in the opened Terminal window

Expected Behavior

The new tab should have the same working director as the first tab, if settings.json is correctly setup.
This is already the case when launching Terminal through the "wt" shorthand, but not via "cmd".

Actual Behavior

The new tab always starts in "C:\Windows\System32" regardless of the starting directory of the first tab.
When launching Terminal through the "wt" shorthand, the new tab will start in the correct directory.

Originally created by @Pieter-Dewachter on GitHub (Jan 30, 2023). ### Windows Terminal version 1.15.3466.0 ### Windows build number 10.0.22621.1105 ### Other Software _No response_ ### Steps to reproduce Reproduce actual (broken) behaviour: 1. When in a particular folder with Explorer, open Terminal by typing "cmd" in the address bar 2. Create a new tab in the opened Terminal window Reproduce expected behaviour: 1. When in a particular folder with Explorer, open Terminal by typing "wt" in the address bar 2. Create a new tab in the opened Terminal window ### Expected Behavior The new tab should have the same working director as the first tab, if settings.json is correctly setup. This is already the case when launching Terminal through the "wt" shorthand, but not via "cmd". ### Actual Behavior The new tab always starts in "C:\Windows\System32" regardless of the starting directory of the first tab. When launching Terminal through the "wt" shorthand, the new tab will start in the correct directory.
claunia added the Issue-BugIssue-TaskProduct-TerminalPriority-2Area-DefApp labels 2026-01-31 06:39:07 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Feb 1, 2023):

Notes:

  • This is different from #5506.
  • We'd need to somehow crack CMD's CWD when it launches and then package that up with the defterm connection for Terminal to read
  • Terminal would then use that as it's "initial" CWD, ala #5506

Or, you could set up your CMD prompt to emit the CWD and then duplicateTab would just do the right thing.

@zadjii-msft commented on GitHub (Feb 1, 2023): Notes: * This is different from #5506. * We'd need to somehow crack CMD's CWD when it launches and then package that up with the defterm connection for Terminal to read * Terminal would then use that as it's "initial" CWD, ala #5506 Or, you could set up your CMD prompt to [emit the CWD](https://learn.microsoft.com/en-us/windows/terminal/tutorials/new-tab-same-directory) and then `duplicateTab` would just do the right thing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19289