Skip to content

Get-Clipboard

SYNOPSIS

Gets the contents of the clipboard.

SYNTAX

Get-Clipboard [-Raw] [<CommonParameters>]

DESCRIPTION

> This cmdlet is not supported on macOS. The `Get-Clipboard` cmdlet gets the contents of the clipboard as text. Multiple lines of text are returned as an array of strings similar to `Get-Content`.

> [!NOTE] > On Linux, this cmdlet requires the `xclip` utility to be in the path.

EXAMPLES

Example 1: Get the content of the clipboard and display it to the command-line

Get-Clipboard

hello

PARAMETERS

-Raw

Gets the entire contents of the clipboard. Multiline text is returned as a single multiline string rather than an array of strings.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.String

NOTES

Set-Clipboard

Back to top