Skip to content
Menu
The Lonely Administrator
  • PowerShell Tips & Tricks
  • Books & Training
  • Essential PowerShell Learning Resources
  • Privacy Policy
  • About Me
The Lonely Administrator

Open Windows Terminal PowerShell Split Paned

Posted on May 14, 2020

The other night I presented for the Mississippi PowerShell User Group on how to get started using Windows Terminal. This has been my go-to PowerShell console for quite a while. I use Windows Terminal for everything. During the talk a question came up about starting a session with split panes. This is a very cool feature. I can have a single tab split into different profiles. There isn't an official way to accomplish this, but when using PowerShell I can use the following work around. Ok. You can call it a hack.

Manage and Report Active Directory, Exchange and Microsoft 365 with
ManageEngine ADManager Plus - Download Free Trial

Exclusive offer on ADManager Plus for US and UK regions. Claim now!

First off, in your Windows Terminal settings.json file, you need to define a key binding that opens a desired profile.

{
    "command": {
        "action": "splitPane",
        "split": "auto",
        "profile": "Windows PowerShell No Profile",
        "startingDirectory": "C:\\",
        "tabTitle": "PS Clean"
    },
    "keys": [
        "ctrl+shift+<"
    ]
}

This key combo will open my Windows Terminal profile that launches Windows PowerShell with no profile.

Next, I'll edit my Windows PowerShell profile script. I could do the same thing for PowerShell 7. But my goal is that when I launch Windows PowerShell in Windows Terminal I'll get a split screen. One panel has my profile loaded and the other is clean.

At the end of the profile script, I add this code.

if ( $env:wt_session) {
    #split the screen
    $wshell = New-Object -ComObject Wscript.Shell
    $wshell.sendkeys("^+<")
} #in a WT Session

Yes. This is a SendKeys VBScript hack. But it works!

wt-splitThe tab title will change depending on which PowerShell panel has focus.

You could achieve similar results by using  wt.exe  but personally, I find it a bit clunky to use and it will launch a new instance of Windows Terminal. I'm hoping that some future version will have a better solution. But in the meantime, at least for PowerShell, I have something that works.


Behind the PowerShell Pipeline

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to print (Opens in new window) Print
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

3 thoughts on “Open Windows Terminal PowerShell Split Paned”

  1. Ray Ebersole says:
    May 14, 2020 at 10:48 pm

    As I’ve mentioned before, the lack of “open as a different user” such as my admin account is a game stopper for Windows Terminal. I’ve started using the compatibility mode for Office365, and AzureAD so that I can work in Windows Terminal with PowerShell 7.

    Instead of running ConEMU for multiple tabs, I’m loading WT in what I call O365 mode while I run my admin account straight from in PS 7.

    1. Jeffery Hicks says:
      May 15, 2020 at 8:46 am

      I am under no illusion that Windows Terminal is right for everyone. Even for me there are a number of areas I hope they address in future releases.

    2. Todd Klindt says:
      May 15, 2020 at 1:49 pm

      If you’re using PowerShell with Office 365 and AzureAD it doesn’t matter who PowerShell is running as, does it? I use Windows Terminal everyday with them and with Windows PowerShell and it works pretty well.

Comments are closed.

reports

Powered by Buttondown.

Join me on Mastodon

The PowerShell Practice Primer
Learn PowerShell in a Month of Lunches Fourth edition


Get More PowerShell Books

Other Online Content

github



PluralSightAuthor

Active Directory ADSI Automation Backup Books CIM CLI conferences console Friday Fun FridayFun Function functions Get-WMIObject GitHub hashtable HTML Hyper-V Iron Scripter ISE Measure-Object module modules MrRoboto new-object objects Out-Gridview Pipeline PowerShell PowerShell ISE Profile prompt Registry Regular Expressions remoting SAPIEN ScriptBlock Scripting Techmentor Training VBScript WMI WPF Write-Host xml

©2025 The Lonely Administrator | Powered by SuperbThemes!
%d