0

I want keep WindowsTerminal screen remaining after running command for debugging purpose. To achieve this, try running the pause command after the command completes.

wt new-tab powershell "ping stackoverflow.com;pause"

But in WindowsTerminal use ; as a delimiter for separating commands in the wt command line. Even try escape it not work

In many post they are only interested in running commands on multiple panels.

I achieve this by another way with powershell's -NoExit flag.

wt new-tab powershell -NoExit -c "ping stackoverflow.com"

But I still have a question to run multiple commands sequentially in WindowsTerminal.

1
  • Thanks for reposting this over here. In looking for the answer, I came across a possible duplicate question/answer. That answer seems to work for your use case -- Use \ to escape the semicolon (you were probably trying a backtick, like I did originally). So for your example, wt new-tab powershell "ping stackoverflow.com \; pause". If that takes care of it for you, just accept the "duplicate" suggestion (should be in the header for you) and upvote the other question/answer. If not, let us know, and we can dig in more. Thanks! Sep 19, 2021 at 18:57

1 Answer 1

0

I'm not sure if I understood well what you want to achieve, try this:

Make a main.bat where you will going to launch multiple .bat files (having multiple commands sequentially) in separate WindowsTerminal tabs.

example of main.bat:

wt -w 0 new-tab start powershell.exe -NoExit c:\batch\commands1.bat 
wt -w 0 new-tab start powershell.exe -NoExit c:\batch\commands2.bat
wt -w 0 new-tab start powershell.exe -NoExit c:\batch\commands3.bat

example of commands1.bat:

ping stackoverflow.com
ping google.com
echo finished

etc.

Running main.bat will open WindowsTerminal with 3 new tabs, in everyone of which the specified commands{0-3}.bat batch file will be executed without closing them after command lines finish executing.

Hope this helps.

Not the answer you're looking for? Browse other questions tagged .