Skip to main content

WPF.Pwsh

A WPF control that hosts a real PowerShell session (ConPTY). The shell starts with the control, is rendered through the Windows Terminal control, and raises an event when it exits.

Windows only, net8.0-windows and net10.0-windows.

Installation​

Install-Package FrApp42.WPF.Pwsh

Usage​

// pwsh.exe, with powershell.exe as fallback
var terminal = new FrApp42.WPF.Pwsh.PwshTerminal();

// the shell exited
terminal.OnSessionDisconnected += (_, _) => CloseTab();

Content = terminal;
MemberDescription
new PwshTerminal("wsl.exe")Runs any other shell instead of PowerShell
WorkingDirectoryDirectory the shell starts in
FontFamily / FontSizeTerminal font (default MesloLGS Nerd Font Mono, 14)
Disconnect()Kills the shell
Dispose()Tears the session down
OnSessionDisconnectedEvent raised when the shell exits