Get-Clipboard
Gets the contents of the clipboard.
Składnia
Default (Domyślna)
Get-Clipboard
[-Raw]
[<CommonParameters>]
Opis
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.
Przykłady
Example 1: Get the content of the clipboard and display it to the command-line
In this example we have copied the text "hello" into the clipboard.
Get-Clipboard
hello
Parametry
-Raw
Gets the entire contents of the clipboard. Multiline text is returned as a single multiline string rather than an array of strings.
Właściwości parametru
Typ: | SwitchParameter |
Domyślna wartość: | None |
Obsługuje symbole wieloznaczne: | False |
DontShow: | False |
Zestawy parametrów
(All)
Position: | Named |
Obowiązkowy: | False |
Wartość z potoku: | False |
Wartość z potoku według nazwy właściwości: | False |
Wartość z pozostałych argumentów: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Dane wejściowe
None
You can't pipe objects to this cmdlet.
Dane wyjściowe
String
This cmdlet returns a string containing the contents of the clipboard.
Uwagi
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.