-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sending commands to Terminal tabs through the command line #7452
Comments
Could you clarify a bit? Do you want to just run specific commands in each tab when using the commandline? If you did, you could do something like
That'll open three tabs:
If you want to combine a bunch of these commands into a single entry in the new tab dropdown, I'd wait for #1571. That'll let you bind these commands into a single Similar customization would land in the taskbar after #576 |
Hi! Thanks a lot for your help. I didn't think it was possible to send commands to each tab. (The documentation doesn't seem very explicit on that topic.) Your comment made me investigate further, and it seems one of the problems was that I wasn't specifying my start directory for each tab properly. It needs to be a complete path, and I was using ~ as a shortcut to my user profile, which wasn't working. So most tabs seem to work right now. There's just one that's not working, and I can't figure out why. Here's my full command: wt -p "Windows PowerShell" -d C:\Users\arianeb\backend --title backend-srv docker-compose up `; new-tab -p "Windows PowerShell" -d C:\Users\arianeb\frontend --title frontend-srv npm run dev `; new-tab -p "Windows PowerShell" -d C:\Users\arianeb\backend --title backend `; new-tab -p "Windows PowerShell" -d C:\Users\arianeb\frontend --title frontend The second one named "frontend-srv" gives me "[erreur 0x80070002 lors du lancement de `npm run dev']" (sorry, French OS), and then the tab is entirely unresponsive. not even Ctrl-C can save it. There's also another issue: My command is too long for a Windows shortcut. I don't know what the limit is exactly, but when I try to paste it into the "Target" field of a shortcut's properties, it gets cut off. What do you think I should do about that? |
Possible solutions for the overlong command line, from easier to harder:
|
Hi! Creating a .ps1 file with my command allows me to solve the shortcut command length limit. Thanks for the tip! I still have a problem with my second tab giving me an error though. |
The second tab is producing an error because you need to provide the full path to If you run |
Oh, thanks! That'll work. Are you considering adding that functionality? Using programs that were added to the path with the |
Is it necessary to always specify a directory, with the The documentation lacks this kind of advanced examples to run apps or commands in each new tab or new pane. It would be useful to have these in the docs. |
As far as I can tell, the |
@dennohpeter the commandline has to be a valid Windows commandline. So if you want to run
That'll tell Though of course, that'll exit as soon as
(thanks stackoverflow) That |
@zadjii-msft thank you very much for explanation and clarification. That works 🥂 |
I tried the command |
What are those two hyphens followed by a space? |
There's a convention we found among Linux utilities (mostly, ones that use GNU It makes it easier to delete a file called |
Oh, thanks for the info! |
@micktg, you may need to tweak it depending on how/where you invoke it. If you're trying to invoke it from powershell, you may need to use Try this from powershell: That works for me invoking from powershell with bash as my shell and Ubuntu as my default profile.
The end result should be a new, maximized window with |
I'm aware that it's possible to send Windows Terminal itself commands such as "new tab" through the CLI command, as outlined in this documentation page.
I want to go further. I wish I could send each tab PowerShell/other commands to execute, such as
npx webpack
.My use case is that my development environment involves launching a couple of CLI development server program type commands, and then having a couple more terminal tabs for occasional commands. I wish I could create a Windows shortcut doing all that that would auto-launch Windows Terminal and all my development toolkit by adding it to shell:startup.
Additionally, it would be nice if I could save that "startup bundle" and save it to my taskbar under the normal Windows Terminal icon for quick launch later on, too.
The text was updated successfully, but these errors were encountered: