Skip to content

Add support for wt.exe to run commands in an existing Terminal Window #4472

Closed

Description

@Danthar

Description of the new feature/enhancement

I have been playing around with Jetbrains Rider, and when i start a console app with that IDE, it runs the console window inside a docked window in the IDE.

So what i was thinking. How cool would it be, if Windows Terminal allows external applications to start a new Console window in the currently running Windows Terminal instance.

That way whether its VisualStudio or Rider, those IDE's can be configured to start a new Console window inside the Windows Terminal instance.

The way i see this working is: I press F5/ctrl-F5 in visual studio, and instead of opening a new cmd console window, a new tab appears in my running Windows Terminal instance.

Activity

  1. added
    Issue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.
    on Feb 5, 2020
  2. ghost added
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Feb 5, 2020
  3. ghost added
    Needs-Tag-FixDoesn't match tag requirements
    on Feb 5, 2020
  4. lostmsu commented on Feb 6, 2020

    @lostmsu

    Yes, please. There's a Visual Studio extension, that lets you open command line in the current project folder. I set it to launch wt.exe, and it always creates a new window, but I'd love if I could pass a parameter to wt.exe, so that if Terminal is already running, it would be activated a new tab would open there instead.

  5. DHowett-MSFT commented on Feb 7, 2020

    @DHowett-MSFT
    Contributor

    Thanks for the request! I thought we had a backlog item for "allow remote control of a terminal" (like: wt.exe could --remote to control another open instance and add tabs or whatever), but it looks like we don't.

    This is now that issue. Triaged into backlog.

    /cc Mike Griese (@zadjii-msft): I may be wrong in not finding a "remote control" issue

  6. ghost removed
    Needs-Tag-FixDoesn't match tag requirements
    on Feb 7, 2020
  7. changed the title [-]Allow remote applications to start a new shell inside an active WindowsTerminal instance[/-] [+]Allow remote applications to start a new shell inside an active WindowsTerminal instance (remote control?)[/+] on Feb 7, 2020
  8. DHowett-MSFT commented on Feb 7, 2020

    @DHowett-MSFT
    Contributor

    Partially supported by #2080.

  9. zadjii-msft commented on Feb 7, 2020

    @zadjii-msft
    Member

    This was briefly mentioned in this spec

    Future considerations

    • These are some additional argument ideas which are dependent on other features
      that might not land for a long time. These features were still considered as a
      part of the design of this solution, though their implementation is purely
      hypothetical for the time being.
      • Instead of launching a new Windows Terminal window, attach this new
        terminal to an existing one. This would require the work outlined in
        [Spec for tab tear off and default app #2080], so support a "manager" process that could coordinate sessions
        like this.
        • This would be something like wt --session [some-session-id] [commands], where --session [some-session-id] would tell us that
          [more-commands] are intended for the given other session/window.
          That way, you could open a new tab in another window with wt --session 0 cmd.exe (for example).
      • list-sessions: A command to display all the active Windows terminal
        instances and their session ID's, in a way compatible with the above
        command. Again, heavily dependent upon the implementation of [Spec for tab tear off and default app #2080].

    Which yea is part of #2080, but I don't think has it's own issue.

  10. Rumbah2 commented on Feb 14, 2020

    @Rumbah2

    Wow, I was just thinking about "starting a new program/task in any existing windows terminal window" or a "single instance mode" to populate a WT window with multiple tasks via CLI would be great.
    But something like sessions would be even better and more flexible.

    But I admit that I'd prefer a "quick and dirty" single instance mode in the near future over a flexible session management in the distant future (as I could use it sooner than later).

  11. changed the title [-]Allow remote applications to start a new shell inside an active WindowsTerminal instance (remote control?)[/-] [+]Add support for wt.exe to run commands in an existing Terminal Window[/+] on Feb 20, 2020
  12. 69 remaining items

  13. zadjii-msft commented on Aug 30, 2021

    @zadjii-msft
    Member

    Ah, from WSL you'll need:

    cmd.exe /c "wt.exe" -w 0 nt
    

    Execution aliases do not work in WSL distributions. If you want to use wt.exe from a WSL command line, you can spawn it from CMD directly by running cmd.exe. The /c option tells CMD to terminate after running.

    Also, you can read this in the docs

  14. hardeepparmar commented on Aug 30, 2021

    @hardeepparmar
    wt -w 0 nt
    

    wt-w-0

    But this works only from with in cmd tab window.. This does not work if you issue this command from say within powershell tabbed window.

  15. zadjii-msft commented on Aug 30, 2021

    @zadjii-msft
    Member

    But this works only from with in cmd tab window.. This does not work if you issue this command from say within powershell tabbed window.

    wt-w-0--powershell

    🤔

  16. DJackman123 commented on Aug 30, 2021

    @DJackman123
    Contributor

    Beat me to the punch. Yes, it does work in a PowerShell tab. However, it does not work in a Windows Terminal window running as administrator (see #9628).

  17. hardeepparmar commented on Sep 1, 2021

    @hardeepparmar

    Beat me to the punch. Yes, it does work in a PowerShell tab. However, it does not work in a Windows Terminal window running as administrator (see #9628).

    Yes indeed i am running Windows terminal as Administrator and I see this issue...However as you said, if I do not run at as administrator, it works just as expected. Thanks for confirming and making it more explicit and clear.

  18. MetaMmodern commented on Feb 12, 2022

    @MetaMmodern

    For those who are kinda new to this: here is how you can do it the easy way.(Works for me in Windows 10 Pro with Windows Terminal(not Preview))

    1. Open Windows Terminal.
    2. Open Settings.
    3. Checkout this section in the startup menu.
      image
    4. Select as I did.
    5. Test by clicking "Open in Windows Terminal" elsewhere.
      Thanks Microsoft for adding this to GUI)
  19. LawranceFung commented on Feb 13, 2022

    @LawranceFung

    For those who are kinda new to this: here is how you can do it the easy way.

    1. Open Windows Terminal.
    
    2. Open Settings.
    
    3. Checkout this section in the startup menu.
       ![image](https://user-images.githubusercontent.com/42899786/153727389-56f004b6-cd7b-4b35-9531-ef2227e28638.png)
    
    4. Select as I did.
    
    5. Test by clicking "Open in Windows Terminal" elsewhere.
       Thanks Microsoft for adding this to GUI)
    

    Neither "Attach to the most recently used window" nor "Attach to the most recently used window on this desktop" work for me on Windows 11. I am not using the Preview version of Windows Terminal. Any idea what's up?

  20. MetaMmodern commented on Feb 13, 2022

    @MetaMmodern

    For those who are kinda new to this: here is how you can do it the easy way.

    1. Open Windows Terminal.
    
    2. Open Settings.
    
    3. Checkout this section in the startup menu.
       ![image](https://user-images.githubusercontent.com/42899786/153727389-56f004b6-cd7b-4b35-9531-ef2227e28638.png)
    
    4. Select as I did.
    
    5. Test by clicking "Open in Windows Terminal" elsewhere.
       Thanks Microsoft for adding this to GUI)
    

    Neither "Attach to the most recently used window" nor "Attach to the most recently used window on this desktop" work for me on Windows 11. I am not using the Preview version of Windows Terminal. Any idea what's up?

    Sorry, buddy, no idea. Try checking the above comments (like modifying the registry). I'll update my prev comment, cuz I'm on windows 10.

  21. LawranceFung commented on Feb 13, 2022

    @LawranceFung

    Are there plans to launch a new tab in an existing window, but to choose the window based on MRU order?

  22. zadjii-msft commented on Feb 14, 2022

    @zadjii-msft
    Member

    choose the window based on MRU order?

    that's... already how it's supposed to work?
    mru-wt--w-0

  23. DJackman123 commented on Feb 14, 2022

    @DJackman123
  24. zadjii-msft commented on Feb 14, 2022

    @zadjii-msft
  25. LawranceFung commented on Feb 14, 2022

    @LawranceFung

    choose the window based on MRU order?

    that's... already how it's supposed to work? mru-wt--w-0

    That's not working for me when calling
    wt.exe -w 0 nt
    or
    wt.exe -w 1 nt
    via AutoHotkey when both AutoHotkey and both Windows Terminal windows are running as administrator. It always opens the new tab in the first wt window opened.

  26. DJackman123 commented on Feb 14, 2022

    @DJackman123
    Contributor

    Wondering if that is related to #9628. Add this information to that bug so when it's evaluated for 1.14 this scenario will be included in that evaluation.

  27. LawranceFung commented on Feb 14, 2022

    @LawranceFung

    Yes, should be same issue as #9628 barring some strange behavior when called by AHK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area-Commandlinewt.exe's commandline argumentsArea-ServerDown in the muck of API call servicing, interprocess communication, eventing, etc.Issue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Product-TerminalThe new Windows Terminal.Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions