Open a new Terminal tab from command line (instead of a new console window) #7091

Open
opened 2026-01-31 00:54:45 +00:00 by claunia · 0 comments
Owner

Originally created by @awaescher on GitHub (Mar 22, 2020).

The Windows Terminal now has brilliant support for command line arguments like:

  • wt.exe -d . Open a new wt instance in the current working directory
  • wt.exe -p <profile name> Create a wt instance running the given profile, to unblock
  • wt.exe ; new-tab ; split-pane -V Launch the terminal with multiple tabs, splits, to unblock

What's missing for me is, that every time I run wt.exe with arguments, a new console window appears which - of course - only hosts one single tab. I use tabs to manage multiple sessions in one single console window, so it would be huge, if wt.exe command lines could be written to reuse existing windows by "just" adding (and focusing) a new tab.

To avoid misunderstandings: There's an argument new-tab but as far as I know, this can be used to force a new console window to open one or more further new tab(s). This is not what I want: I meant to reuse an existing console window (if available) and open a new tab in there.

I posted this idea on Twitter here. Please read the thread for more information.

In gif below, I use a tool git tool called RepoZ to jump to the directory of a chosen git repository.

image

However, for each "Open In Windows Terminall", a new window is opened where a tab would have been more convenient.

wt-tab-lossy

Proposed technical implementation details

I have no implementation idea how this works in the Windows Terminal process itself.

However, on the command line side, this could be the new default behavior for wt.exe-commands in my opinion. To keep things downwards compatible, we could add a new argument option like wt.exe -d . reuse-window to make sure that Windows Terminal should try to use an existing process if available. If not, I'd suggest that a new Window appears which can be used by subsequent calls with the optiom reuse-window.

Originally created by @awaescher on GitHub (Mar 22, 2020). The Windows Terminal [now has brilliant support for command line arguments](https://github.com/microsoft/terminal/blob/master/doc/user-docs/UsingCommandlineArguments.md) like: * `wt.exe -d .` Open a new wt instance in the current working directory * `wt.exe -p <profile name>` Create a wt instance running the given profile, to unblock * `wt.exe ; new-tab ; split-pane -V` Launch the terminal with multiple tabs, splits, to unblock What's missing for me is, that every time I run `wt.exe` with arguments, a _**new**_ console window appears which - of course - only hosts one single tab. I use tabs to manage multiple sessions in one single console window, so it would be huge, if `wt.exe` command lines could be written to reuse existing windows by "just" adding (and focusing) a new tab. To avoid misunderstandings: There's an argument `new-tab` but as far as I know, this can be used to force a new console window to open one or more further new tab(s). This is not what I want: I meant to reuse an existing console window (if available) and open a new tab in there. I posted [this idea on Twitter here](https://twitter.com/Waescher/status/1239637217599000577). Please read the thread for more information. In gif below, I use [a tool git tool called RepoZ](https://github.com/awaescher/RepoZ) to jump to the directory of a chosen git repository. ![image](https://user-images.githubusercontent.com/3630638/77255046-f7508480-6c64-11ea-80f5-b51e43d9d3cf.png) However, for each "Open In Windows Terminall", a new window is opened where a tab would have been more convenient. ![wt-tab-lossy](https://user-images.githubusercontent.com/3630638/77254748-4990a600-6c63-11ea-882e-976989a5fb24.gif) # Proposed technical implementation details I have no implementation idea how this works in the Windows Terminal process itself. However, on the command line side, this could be the new default behavior for `wt.exe`-commands in my opinion. To keep things downwards compatible, we could add a new argument option like `wt.exe -d . reuse-window` to make sure that Windows Terminal should try to use an existing process if available. If not, I'd suggest that a new Window appears which can be used by subsequent calls with the optiom `reuse-window`.
claunia added the Issue-FeatureResolution-Duplicate labels 2026-01-31 00:54:45 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7091