"Duplicate Tab" Creates a New Tab Instead of Cloning the Current Instance #22938

Closed
opened 2026-01-31 08:27:53 +00:00 by claunia · 3 comments
Owner

Originally created by @marcuwynu23 on GitHub (Feb 19, 2025).

Windows Terminal version

1.21.10351.0

Windows build number

10.0.26100.3194

Other Software

Issue Description

The "Duplicate Tab" feature in Windows Terminal does not correctly clone the current instance. Instead of duplicating the session with the same working directory, environment, and command history, it creates a completely new tab with a fresh session.

🎯 Expected Behavior

When duplicating a tab, the new tab should:

  1. Open in the same working directory as the original tab.
  2. Preserve the command history from the original session.
  3. Retain any environment variables or session-specific configurations.

🛠 Steps to Reproduce

  1. Open Windows Terminal.
  2. Navigate to a different directory using cd (e.g., cd C:\Projects).
  3. Run some commands (e.g., dir, echo Hello).
  4. Right-click the tab and select "Duplicate Tab".
  5. The new tab does not retain the working directory or history.

🔍 Current Behavior

  • The new tab starts in the default shell directory, not the current working directory.
  • Command history is lost, requiring users to manually retype previous commands.
  • Session-specific configurations (e.g., temporary environment variables) are not carried over.

💡 Possible Fixes

For cmd.exe

Instead of starting a fresh cmd.exe, use:

start cmd /K 

Steps to reproduce

  1. Open Windows Terminal.
  2. Open a new tab using a shell (e.g., cmd, PowerShell, WSL).
  3. Navigate to a different directory using cd (e.g., cd C:\Projects).
  4. Run some commands to populate the command history:
    • For cmd:
      echo First Command
      echo Second Command
      
    • For PowerShell:
      Write-Output "First Command"
      Write-Output "Second Command"
      
    • For WSL (Bash):
      echo "First Command"
      echo "Second Command"
      
  5. Right-click the tab and select "Duplicate Tab".

Expected Behavior

The new tab does not retain the working directory.

Actual Behavior

The command history is empty.
Any temporary environment variables or session-specific configurations are lost.

Originally created by @marcuwynu23 on GitHub (Feb 19, 2025). ### Windows Terminal version 1.21.10351.0 ### Windows build number 10.0.26100.3194 ### Other Software ## ✨ Issue Description The **"Duplicate Tab"** feature in Windows Terminal does not correctly clone the current instance. Instead of duplicating the session with the same **working directory, environment, and command history**, it creates a completely new tab with a fresh session. ## 🎯 Expected Behavior When duplicating a tab, the new tab should: 1. Open in the **same working directory** as the original tab. 2. Preserve the **command history** from the original session. 3. Retain any **environment variables** or session-specific configurations. ## 🛠 Steps to Reproduce 1. Open Windows Terminal. 2. Navigate to a different directory using `cd` (e.g., `cd C:\Projects`). 3. Run some commands (e.g., `dir`, `echo Hello`). 4. Right-click the tab and select **"Duplicate Tab"**. 5. The new tab **does not** retain the working directory or history. ## 🔍 Current Behavior - The new tab **starts in the default shell directory**, not the current working directory. - **Command history is lost**, requiring users to manually retype previous commands. - **Session-specific configurations** (e.g., temporary environment variables) are not carried over. ## 💡 Possible Fixes ### ✅ For `cmd.exe` Instead of starting a fresh `cmd.exe`, use: ```cmd start cmd /K ``` ### Steps to reproduce 1. Open Windows Terminal. 2. Open a new tab using a shell (e.g., `cmd`, `PowerShell`, `WSL`). 3. Navigate to a different directory using `cd` (e.g., `cd C:\Projects`). 4. Run some commands to populate the command history: - For `cmd`: ```cmd echo First Command echo Second Command ``` - For PowerShell: ```powershell Write-Output "First Command" Write-Output "Second Command" ``` - For WSL (Bash): ```bash echo "First Command" echo "Second Command" ``` 5. Right-click the tab and select **"Duplicate Tab"**. ### Expected Behavior The new tab does not retain the working directory. ### Actual Behavior The command history is empty. Any temporary environment variables or session-specific configurations are lost.
claunia added the Issue-BugResolution-Duplicate labels 2026-01-31 08:27:53 +00:00
Author
Owner

@similar-issues-ai[bot] commented on GitHub (Feb 19, 2025):

We've found some similar issues:

  • #11678 , similarity score: 82%

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

@similar-issues-ai[bot] commented on GitHub (Feb 19, 2025): We've found some similar issues: - #11678 , similarity score: 82% If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue. > Note: You can give me feedback by 👍 or 👎 this comment.
Author
Owner

@carlos-zamora commented on GitHub (Feb 19, 2025):

Thanks for filing! We're going to mark this as a /duplicate of #5047

@carlos-zamora commented on GitHub (Feb 19, 2025): Thanks for filing! We're going to mark this as a /duplicate of #5047
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Feb 19, 2025):

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 (Feb 19, 2025): 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! <!-- Policy app identification https://img.shields.io/static/v1?label=PullRequestIssueManagement. -->
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22938