Search code examples
windows-terminal

Windows terminal, start two commands in tabs


I'd like to create a script that starts two shell processes in two different tabs of Windows Terminal. There is a parameter called "new-tab" but I can't make it work at all.

Is it possible to create a single script that opens Windows Terminal and run two console applications in two different tabs?

Thanks,


Solution

  • By script, I hope you mean batch script, in which case try this:

    wt.exe -w 1 nt PowerShell -c node "sample.js"
    wt.exe -w 1 nt PowerShell -c npm test
    

    To change the title of the tab use the --title argument.

    wt.exe --title MyCoolTab
    

    The full list of available command line arguments can be viewed here: https://learn.microsoft.com/en-us/windows/terminal/command-line-arguments