Skip to content

Conversation

Copy link

Copilot AI commented Dec 18, 2025

The tutorial instructed users to add PROMPT_COMMAND to .bash_profile, which only loads for login shells. Windows Terminal opens new tabs/panes as non-login shells, causing the duplicate-tab-in-same-directory feature to fail.

Changes

  • Changed bash section to use .bashrc instead of .bash_profile
  • Added note explaining login vs non-login shell behavior
  • Fixed spacing in PROMPT_COMMAND assignment (removed extraneous space before semicolon)
  • Aligned with MINGW section which already correctly used .bashrc

Before:

# In .bash_profile (not loaded for new tabs/panes)
PROMPT_COMMAND=${PROMPT_COMMAND:+"$PROMPT_COMMAND ; "}'printf "\e]9;9;%s\e\\" "$(wslpath -w "$PWD")"'

After:

# In .bashrc (loaded for new tabs/panes)
PROMPT_COMMAND=${PROMPT_COMMAND:+"$PROMPT_COMMAND; "}'printf "\e]9;9;%s\e\\" "$(wslpath -w "$PWD")"'
Original prompt

This section details on the original issue you should resolve

<issue_title>Opening a tab or pane in the same directory in Windows Terminal</issue_title>
<issue_description>### Type of issue

Code doesn't work

Feedback

The tutorial here https://learn.microsoft.com/en-us/windows/terminal/tutorials/new-tab-same-directory specifically for the WSL bash setup doesn't allow you to duplicate the terminal window in the CWD. I've tried a few things. Adding this to the .bash_profile PROMPT_COMMAND=${PROMPT_COMMAND:+"$PROMPT_COMMAND; "}'printf "\e]9;9;%s\e\\" "$(wslpath -w "$PWD")"'

The only thing I get is a colorless prompt which is not in the directory being duplicated. If I add this to the bottom of my .bash_rc I get no change to the behavior of bash. Any updates or changes would be greatly appreciated!

Page URL

https://learn.microsoft.com/en-us/windows/terminal/tutorials/new-tab-same-directory

Content source URL

https://github.com/MicrosoftDocs/terminal/blob/main/TerminalDocs/tutorials/new-tab-same-directory.md

Author

@zadjii-msft

Document Id

439baddf-3ec9-a46e-1b6e-3ec47cbd1d4c</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@learn-build-service-prod
Copy link

Learn Build status updates of commit a963a93:

✅ Validation status: passed

For more details, please refer to the build report.

Co-authored-by: mattwojo <7566797+mattwojo@users.noreply.github.com>
@learn-build-service-prod
Copy link

Learn Build status updates of commit ec8c36a:

✅ Validation status: passed

File Status Preview URL Details
TerminalDocs/tutorials/new-tab-same-directory.md ✅Succeeded View

For more details, please refer to the build report.

@learn-build-service-prod
Copy link

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

Copilot AI changed the title [WIP] Fix issue with opening tab in same directory in Windows Terminal Fix bash configuration to use .bashrc for WSL duplicate tab feature Dec 18, 2025
Copilot AI requested a review from mattwojo December 18, 2025 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opening a tab or pane in the same directory in Windows Terminal

2 participants