Skip to content

New tab doesn't inherit working directory for -d #18604

Closed

Description

Windows Terminal version

1.22.10352.0

Windows build number

10.0.19045.0

Other Software

No response

Steps to reproduce

Press Win+R
Execute wt -d c:\Projects to specify the folder that should be used as the starting directory for the console (according to documentation)
Open a new tab

Expected Behavior

For cases when wt -d used target directory should be inherited properly for new tabs and should be equal as the starting directory specified on console run

Actual Behavior

Currently, the path is C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.22.10352.0_x64__8wekyb3d8bbwe> instead of what you chose as the starting directory

Activity

  1. added
    Issue-BugIt either shouldn't be doing this or needs an investigation.
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Feb 20, 2025
  2. zadjii-msft commented on Feb 26, 2025

    @zadjii-msft
    Member

    Lemme at least cross link some thoughts here:

    If I'm reading you right, you basically want to be able to have -d . apply to additional tabs created in that terminal window, not just the tab that wt -d . opens. I suspect that just using "Duplicate tab" rather than "Open new tab" will probably get you want you want here.

  3. QuAzI commented on Feb 27, 2025

    @QuAzI
    Author

    -d . means that I will use the current directory, not the starting directory. So, it's different.
    At the same time, Duplicate tab starts with the starting directory, while I expected that it will inherit the current path too) And it absolutely doesn't work for different profiles, WSL for example

  4. quyenvsp commented on Mar 18, 2025

    @quyenvsp

    same here, I remember it work before but not latest Terminal Preview version. Duplicate tab work but can not switch profile like from Git bash to CMD. new CMD tab will open system32 instead of Parent process directory

  5. DHowett commented on Mar 26, 2025

    @DHowett
    Member

    This may have regressed in our windowing and remoting rewrite in #18215. Thanks!

  6. added
    Area-RemotingCommunication layer between windows. Often for windowing behavior, quake mode, etc.
    and removed
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Mar 26, 2025
  7. DHowett commented on Mar 26, 2025

    @DHowett
    Member

    Actually, given that the original report is on 1.22 and Quyen Le Van (@quyenvsp) is talking about Preview... there may be two issues here.

  8. zadjii-msft commented on Mar 27, 2025

    @zadjii-msft
    Member

    okay team notes:

    • "duplicate tab" needs to copy the NewTerminalArgs from the previous tab, not sure if we did all those. Pretty sure there's a thread for that. But IIRC we already duplicated the CWD.
    • -d . is Special though, cause it has to evaluate based on the CWD that the wt command was run in.
    • So duplicating a tab with -d . needs to evaluate the startingDirectory not as . but as... one of?
      • the CWD of the tab being duplicated (else the CWD that tab was launched in)
      • just the CWD that tab was launched in (ignore the CWD of that tab now)
  9. QuAzI commented on Mar 27, 2025

    @QuAzI
    Author

    For me Duplicate sounds like "same shell in the same path", so CWD of the tab being duplicated. But NEW tab ("+") should be based on CWD that main tab/wt was launched

  10. lhecker commented on Apr 16, 2025

    @lhecker
    Member

    Oh, I forgot to close this issue when I fixed the bug in #18801. It'll go out in the next bug fix release. Thanks everyone!

  11. moved this from To Cherry Pick to Rejected in 1.22 Servicing Pipelineon Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-RemotingCommunication layer between windows. Often for windowing behavior, quake mode, etc.Area-WindowingWindow frame, quake mode, tearoutIssue-BugIt either shouldn't be doing this or needs an investigation.Needs-Tag-FixDoesn't match tag requirementsPriority-3A description (P3)Product-TerminalThe new Windows Terminal.

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions