Skip to content
ConsoleMonster
Cmdlet

Copy-ConsoleOutput

Module ConsoleMonster
Inputs
System.Object
Outputs
System.String

Copies widgets, frames, text or pipeline objects to the operating-system clipboard.

Syntax

Copy-ConsoleOutput [-As <Text|Markdown|Html>] [-Culture <CultureInfo>] [-Height <Int32>] [-InputObject] <Object> [-PassThru] [-Width <Int32>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Copies widgets, frames, text or pipeline objects to the operating-system clipboard.

Serializes input with ConsoleExporter as Text (default), Markdown or Html and copies the source as Unicode text. Markdown uses GFM tables, property/value lists and nested tree bullets, including the shared value presenters and totals. Text preserves the console layout inside a text fence. A rendered frame or live-session snapshot retains a fenced fallback. Windows uses its native clipboard, macOS uses pbcopy, and Linux uses wl-copy (Wayland) or xclip (X11). SSH, a missing desktop/provider or a failing provider produces a non-terminating error; use -ErrorAction Stop to catch it. No output is written unless -PassThru succeeds. -WhatIf exports without accessing the clipboard.

Examples

Authored help example

EXAMPLE 1

Get-Process | Select-Object -First 10 Name, Id | Format-ConsoleTable -AsWidget | Copy-ConsoleOutput -As Markdown

Copy a process table into a Markdown report

Parameters

-As String optional
Copies Text, Markdown or Html source as clipboard text (default Text).
Possible values: Text, Markdown, Html
-Culture CultureInfo optional
The culture for values in objects and widgets.
-Height Int32 optional
Height in cells, or 0 to measure the full content.
-InputObject Object requiredposition: 0pipeline: True (ByValue)
Widgets, rendered frames, live sessions, literal text or objects to display as tables.
-PassThru SwitchParameter optional
Also returns the serialized document after a successful copy.
-Width Int32 optional
Width in cells for rendering widgets and objects (default 100); single frames keep their own size.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.