Add support for wt.exe to run commands in the current Terminal Window #6534

Closed
opened 2026-01-31 00:41:03 +00:00 by claunia · 9 comments
Owner

Originally created by @plusls on GitHub (Feb 20, 2020).

Description of the new feature/enhancement

I found that wt.exe can open a new window and split it, can it split current window like tmux split-window -v, tmux split-window -h?
like this:
image

Proposed technical implementation details (optional)

Originally created by @plusls on GitHub (Feb 20, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement I found that wt.exe can open a new window and split it, can it split current window like `tmux split-window -v`, `tmux split-window -h`? like this: ![image](https://user-images.githubusercontent.com/23459592/74924879-38f3d280-540e-11ea-8813-e38ed501bd4e.png) <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> # Proposed technical implementation details (optional) <!-- A clear and concise description of what you want to happen. -->
Author
Owner

@zadjii-msft commented on GitHub (Feb 20, 2020):

Yep, it absolutely can! See this doc for more details.

9df9bd00d7/doc/user-docs/UsingCommandlineArguments.md (L115-L130)

Consider the following commandline:

wt ; split-pane -p "Windows PowerShell" ; split-pane -H wsl.exe 

This creates a new Windows Terminal window with one tab, and 3 panes:

  • wt: Creates the new tab with the default profile
  • split-pane -p "Windows PowerShell": This will create a new pane, split from the parent with the default profile. This pane will open with the "Windows PowerShell" profile
  • split-pane -H wsl.exe: This will create a third pane, slit horizontally from the "Windows PowerShell" pane. It will be running the default profile, and will use wsl.exe as the commandline (instead of the default profile's commandline).
@zadjii-msft commented on GitHub (Feb 20, 2020): Yep, it absolutely can! See [this doc](https://github.com/microsoft/terminal/blob/master/doc/user-docs/UsingCommandlineArguments.md#opening-with-multiple-panes) for more details. https://github.com/microsoft/terminal/blob/9df9bd00d74e7910395306f551fc57a673155a7a/doc/user-docs/UsingCommandlineArguments.md#L115-L130 > Consider the following commandline: > ```powershell > wt ; split-pane -p "Windows PowerShell" ; split-pane -H wsl.exe > ``` > This creates a new Windows Terminal window with one tab, and 3 panes: > * `wt`: Creates the new tab with the default profile > * `split-pane -p "Windows PowerShell"`: This will create a new pane, split from the parent with the default profile. This pane will open with the "Windows PowerShell" profile > * `split-pane -H wsl.exe`: This will create a third pane, slit _horizontally_ from the "Windows PowerShell" pane. It will be running the default profile, and will use `wsl.exe` as the commandline (instead of the default profile's `commandline`).
Author
Owner

@plusls commented on GitHub (Feb 20, 2020):

but i want split current window

@plusls commented on GitHub (Feb 20, 2020): but i want split current window
Author
Owner

@plusls commented on GitHub (Feb 20, 2020):

wt ; split-pane -p "Windows PowerShell" ; split-pane -H wsl.exe 

it will open a new terminal...

@plusls commented on GitHub (Feb 20, 2020): ```powershell wt ; split-pane -p "Windows PowerShell" ; split-pane -H wsl.exe ``` it will open a new terminal...
Author
Owner

@zadjii-msft commented on GitHub (Feb 20, 2020):

Sure yea you can do that in the current window. Use the splitPane keybindings. By default, these are bound to the following keys:
39d3c65420/src/cascadia/TerminalApp/defaults.json (L242-L243)

@zadjii-msft commented on GitHub (Feb 20, 2020): Sure yea you can do that in the current window. Use the `splitPane` keybindings. By default, these are bound to the following keys: https://github.com/microsoft/terminal/blob/39d3c6542006fa3cd45d85fc00e9d546a1398625/src/cascadia/TerminalApp/defaults.json#L242-L243
Author
Owner

@plusls commented on GitHub (Feb 20, 2020):

but I want use a shell command to do it, I want to write it in my script.

@plusls commented on GitHub (Feb 20, 2020): but I want use a shell command to do it, I want to write it in my script.
Author
Owner

@zadjii-msft commented on GitHub (Feb 20, 2020):

Unfortunately, that's not supported quite yet. It's mentioned in the "future considerations" part of the original spec. It's sort-of tracked as a sub-point in #4632, but there's not a dedicated thread for it yet.

Congratulations, this is now the thread

@zadjii-msft commented on GitHub (Feb 20, 2020): Unfortunately, that's not supported quite yet. It's mentioned in the "future considerations" part of the [original spec](https://github.com/microsoft/terminal/blob/master/doc/specs/%23607%20-%20Commandline%20Arguments%20for%20the%20Windows%20Terminal.md#future-considerations). It's sort-of tracked as a sub-point in #4632, but there's not a dedicated thread for it yet. _Congratulations_, this is now the thread
Author
Owner

@DHowett-MSFT commented on GitHub (Feb 20, 2020):

We actually do have a thread for it, /dup #4472!

@DHowett-MSFT commented on GitHub (Feb 20, 2020): We actually do have a thread for it, /dup #4472!
Author
Owner

@ghost commented on GitHub (Feb 20, 2020):

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!

@ghost commented on GitHub (Feb 20, 2020): 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!
Author
Owner

@lewis-munyi commented on GitHub (Jun 4, 2020):

Description of the new feature/enhancement

I found that wt.exe can open a new window and split it, can it split current window like tmux split-window -v, tmux split-window -h?
like this:
image

Proposed technical implementation details (optional)

@plusls I use this workaround.

Create a function in my default profile that opens the new tab with split windows and exits the previous tab.

# %USERPROFILE%\OneDrive\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
Function split{
    # Open window with split panes
    start-process wt ' -p "Windows Powershell" ; split-pane -p "Windows Powershell" ; split-pane -H -p "Ubuntu"';
    # Exit
    echo "Exiting...!";
    Exit(0);
}

Then call the function from the terminal when needed.

> split

@lewis-munyi commented on GitHub (Jun 4, 2020): > # Description of the new feature/enhancement > I found that wt.exe can open a new window and split it, can it split current window like `tmux split-window -v`, `tmux split-window -h`? > like this: > ![image](https://user-images.githubusercontent.com/23459592/74924879-38f3d280-540e-11ea-8813-e38ed501bd4e.png) > > # Proposed technical implementation details (optional) @plusls I use this workaround. Create a function in my default profile that opens the new tab with split windows and exits the previous tab. ``` # %USERPROFILE%\OneDrive\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 Function split{ # Open window with split panes start-process wt ' -p "Windows Powershell" ; split-pane -p "Windows Powershell" ; split-pane -H -p "Ubuntu"'; # Exit echo "Exiting...!"; Exit(0); } ``` Then call the function from the terminal when needed. `> split`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6534