Repository navigation
Closed
Labels
Area-SettingsIssues related to settings and customizability, for console or terminalIssues related to settings and customizability, for console or terminalArea-VTVirtual Terminal sequence supportVirtual Terminal sequence supportIn-PRThis issue has a related PRThis issue has a related PRIssue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Complex enough to require an in depth planning process and actual budgeted, scheduled work.Needs-Tag-FixDoesn't match tag requirementsDoesn't match tag requirementsProduct-ConptyFor console issues specifically related to conptyFor console issues specifically related to conptyProduct-PowershellIssues in the modern command interpreter, Powershell.exe.Issues in the modern command interpreter, Powershell.exe.Product-TerminalThe new Windows Terminal.The new Windows Terminal.
Milestone
Description
Description of the new feature/enhancement
Have the option (or default) of a new terminal tab opening in the current directory of the window of which you hit the hotkey to open a new tab. This is the standard way most linux terminals work and is most handy. I often work in a directory where I need to launch multiple seperate processes, its a pain to CD back into the directory each time.
Proposed technical implementation details (optional)
Hit the new tab hotkey, the new terminal should then be in the same folder as the previouse.
maintainer edit: Before commenting, make sure to check out
Tutorial: Opening a tab or pane in the same directory in Windows Terminal
This is largely something configurable today, this issue is just tracking another way of configuring this
Reacted by Stuart Leeks, boyned//Kampfkarren, SamZ, Dmitri, Matt Wojick, Adam Krantz, Stefano Arlandini, David Hewitt, Liam Duffy, Jorge Franzon and 525 more
Reacted by gabezal and Alan
Reacted by Guilherme Ferreira, Nhat Tran, William La Cava and S V
Reacted by Cosimo Chellini, Björn Hjorth, Jay Harris, Sammy Henningsson, Pranav, Bruno Macabeus, Hernán Cervera, Krishna Upadhyay, Po-wei, Guilherme Ferreira and 4 more
Reacted by Martin Andersson, Neil Graham, Christopher Pfohl, Yevhenii Kozii, parsehex, MarcoJayUsai, jpmag, Carter Barnes, Alejandro Lazo, Rehan V and 26 more
Reacted by Cosimo Chellini, Björn Hjorth, Sammy Henningsson, Kevin Wittek, Ilán Vivanco, Pranav, Hernán Cervera, zqqq, Krishna Upadhyay, Guilherme Ferreira and 6 more
Reacted by Cosimo Chellini, Kevin Wittek, Pranav, Hernán Cervera, zqqq, Krishna Upadhyay, Eon, Guilherme Ferreira, Yegun Kim, Kadeluxe and 4 more
Metadata
Metadata
Assignees
Labels
Area-SettingsIssues related to settings and customizability, for console or terminalIssues related to settings and customizability, for console or terminalArea-VTVirtual Terminal sequence supportVirtual Terminal sequence supportIn-PRThis issue has a related PRThis issue has a related PRIssue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Complex enough to require an in depth planning process and actual budgeted, scheduled work.Needs-Tag-FixDoesn't match tag requirementsDoesn't match tag requirementsProduct-ConptyFor console issues specifically related to conptyFor console issues specifically related to conptyProduct-PowershellIssues in the modern command interpreter, Powershell.exe.Issues in the modern command interpreter, Powershell.exe.Product-TerminalThe new Windows Terminal.The new Windows Terminal.
Activity
egmontkob commentedon Oct 11, 2019
There's a "standard" escape sequence (OSC 7 ; URI ST) to set the terminal emulator's belief about the current directory. It originates from macOS Terminal.app, and was later adopted by some other ones, including GNOME Terminal and as far as I know Konsole too.
Another possible approach is to do some OS-specific hacks to examine the inner state of the child process (or even further down to descendents).
Yet another possibility is to mix the two, e.g. go to the directory set via OSC 7 if it was ever emitted, otherwise dig into the process.
The advantage of the OSC 7 approach is that it's clever regarding when to and when not to follow a child process. E.g. you start another nested subshell, it'll be the subdirectory of that subshell that's taken into account because that one also emits this sequence. However, launch an app that internally changes directory (e.g. make) and it – luckily – won't be make's internal subdir that's used.
The disadvantage of OSC 7 is that it requires cooperation from the shell, or other apps that matter.
DHowett-MSFT commentedon Oct 14, 2019
I've been rejecting this feature request for as long as this project has been open-source, and I never learned about OSC 7. This is very exciting.
I'm not happy to crawl through the process tree to dig up the leafmost process's CWD, but I am extremely happy to support OSC 7.
[-]Open new terminal tab is same directory as previouse[/-][+]Open new terminal tab in same directory as existing tab[/+][-]Open new terminal tab in same directory as existing tab[/-][+]Open new terminal tab in same directory as existing tab (OSC 7?)[/+]davidhewitt commentedon Nov 15, 2019
FYI I asked about OSC 7 handling for Alacritty, which eventually led to this issue being created in the "Terminal WG" on gitlab: https://gitlab.freedesktop.org/terminal-wg/specifications/issues/20
There's not been much movement on that ticket, but you may be interested to follow it. Especially if you guys have any opinions regarding what a "formal" specification for OSC 7 might look like.
189 remaining items
nacitar commentedon Apr 7, 2025
In your windows terminal settings:
I can confirm that mine works without that present and using PWD directly like I suggested. My guess is that is overriding it.
... also make sure you're using duplicateTab
0anton commentedon Apr 8, 2025
Thank you a lot Jacob McIntosh (@nacitar)!
I'm unsure what has worked at the end, but this combination "does the needful":
I had to ensure I'm using duplicate pane: action
Simplified
PROMPT_COMMANDversion with just$PWDworks actually fine, so I've started using it:startingDirectory set to "current dir":
With all this I indeed can duplicate tab to the same dir, which saves a lot of time to me! Resolved to me.
hktkqj commentedon Apr 9, 2025
For those struggling to duplicate/split WSL tabs in same diretory, please ensure that the startup command line for the distribution profile uses
wsl -d <distro>instead ofubuntu2204.exelike executable, as for some reason this affects the passing of the CWD.working-name commentedon Apr 19, 2025
Right, or this default junk somehow generated:
Remove --cd ~, that forces to always cd into the linux user's home folder.
Thanks Anton Golubev (@0anton)
pavangayakwad commentedon May 3, 2025
This is a commonsense and the most useful UX, really disappointed to see that it is not implemented till date. I just also wish Terminal remember its previous state when re-opened.
shanselman commentedon Jan 31, 2026
Pavan (@pavangayakwad) https://github.com/shanselman/splitpanefix
Document critical WSL profile fix for directory persistence
Detect WSL profiles using Ubuntu.exe launcher and warn user
Implement OSC 7 for setting the CWD (microsoft#20019)
Implement OSC 7 for setting the CWD (#20019)
JoshuaKasa commentedon May 15, 2026
Hi! I've just came across this thread and started working on it, I will link the PR once I'm done working with it!
zadjii-msft commentedon May 15, 2026
Tommaso Santamaria (@JoshuaKasa) what approach are you taking?
FWIW OSC 7 support merged ~1 month ago, and OSC9;9 merged years ago. If you have something else valuable to contribute in this space, I'd be highly curious