external help file | Locale | Module Name | ms.date | online version | schema | title |
---|---|---|---|---|---|---|
Microsoft.PowerShell.Commands.Management.dll-Help.xml |
en-US |
Microsoft.PowerShell.Management |
08/30/2024 |
2.0.0 |
Get-Clipboard |
Gets the contents of the clipboard.
Get-Clipboard [-Raw] [<CommonParameters>]
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. On macOS, this cmdlet uses
the pbpaste
utility.
In this example we have copied the text "hello" into the clipboard.
Get-Clipboard
hello
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: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
You can't pipe objects to this cmdlet.
This cmdlet returns a string containing the contents of the clipboard.
PowerShell includes the following aliases for Get-Clipboard
:
- All platforms:
gcb
Support for this cmdlet on macOS was added in the PowerShell 7.0.0 release.