Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open a new tab in the running instance of windows terminal from CLI

Is there a way to open a new tab in a running instance of windows terminal from CLI and make it point to a specific folder?

Everytime I run wt.exe -d c:\my-folder it opens a new window.

like image 300
Hemanshu Bhojak Avatar asked Feb 16 '20 22:02

Hemanshu Bhojak


People also ask

How do I open multiple tabs in Windows Terminal?

Using the new tab button and dropdown menu If you'd like to open a new pane of your default profile, you can hold the alt key and click the new tab button.

How do I open a new tab in PowerShell?

To create and use a new PowerShell TabOn the File menu, click New PowerShell Tab. The new PowerShell tab always opens as the active window. PowerShell tabs are incrementally numbered in the order that they are opened.


2 Answers

If someone needs the commands to create a new tab (and not open a new window) from a context menu item are: (if you are already in the directory):

wt -w 0 nt

(and if you click on the directory):

wt -w 0 nt -d %1

(to open in the current directory):

wt -w 0 nt -d %CD%

You can add these commands in the respective registry of each item (or in a new one)

Source: the GitHub discussion in the other answer.

if you run that in cmd or a script, it launches a new instance if none already running, or adds a tab if there is a running instance.

like image 64
domechomsky Avatar answered Oct 25 '22 21:10

domechomsky


Now, we have this option in Windows Terminal's Settings.

enter image description here

like image 32
Mai Hai Avatar answered Oct 25 '22 19:10

Mai Hai