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?
Every time I run wt.exe -d c:\my-folder
it opens a new window.
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?
Every time I run wt.exe -d c:\my-folder
it opens a new window.
If someone needs the commands to create a new tab (and not open a new window) from a context menu item: (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.
This is an outstanding issue that is going to get fixed eventually: Add support for wt.exe to run commands in an existing Terminal Window #4472
No, as per the documentation, calling wt.exe
...will always open a new window. Windows Terminal is not yet capable of opening new tabs or panes in an existing instance.
You can the tool neWin, a CLI command that opens new Window(s) or Tab(s) on WSL Windows Terminal (or KDE Konsole on native linux) and executes given bash command(s).
$ newin --workdir ~/myproject 'npm run start' 'npm run test:watch'
# executes each command in a separate new window and exit.
It runs on nodejs, works great on package.json scripts, but can also be used in any environment/platform.
(disclaimer: I'm the author of neWin)