PowerShell Commands

Get-Clipboard

Get-Clipboard [-Format {Text | FileDropList | Image | Audio}] [-Raw] [-TextFormatType {Text | UnicodeText | Rtf |Html | CommaSeparatedValue}] [<CommonParameters>]

The Get-Clipboard cmdlet gets the current Windows clipboard entry.

Parameters

-Format <ClipboardFormat>

  • Default value is None
  • Accepts pipeline input False

Specifies the type, or format, of the clipboard. The acceptable values for this parameter are:

- Text

- FileDropList

- Image

- Audio

-Raw [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Indicates that this cmdlet ignores newline characters and gets the entire contents of the clipboard.

-TextFormatType <TextDataFormat>

  • Default value is None
  • Accepts pipeline input False

Specifies the text data format type of the clipboard. The acceptable values for this parameter are:

- Text

- UnicodeText

- Rtf

- Html

- CommaSeparatedValue

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

Outputs
System.String, System.IO.FileInfo, System.IO.Stream, System.Drawing.Image
Examples
  1. Get the content of the clipboard and display it to the command-line:
    PS C:\> Get-Clipboard
    This is a test string.
    

    This command displays the contents of the clipboard to the command-line.

  2. Get the content of the clipboard and display it to the command-line:
    PS C:\> Get-Clipboard
    http://upload.wikimedia.org/wikipedia/en/7/7f/Windows_PowerShell_icon.png
    

    This command displays the link, as a URL, of the image that is stored in the clipboard.

Additional Notes

This work is licensed under a Creative Commons Attribution 4.0 International. It is attributed to Microsoft Corporation and can be found here.

PowerShell Commands