You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Get/Set-Clipboard command missing from PowerShell Core Edition on Mac #3618
PowerShell Core Edition doesn't have a Set-Clipboard command. I've tried using pbcopy on Mac OS X, but it doesn't seem to work well with certain UTF-8 characters, like emojis. For example, using my Emojis PowerShell module, on the PowerShell Gallery, the pbcopy command pastes an emoji into my web browser as a question mark.
Having a high-quality Set-Clipboard command would be convenient from a first-class PowerShell perspective, and resolving bugs similar to those with pbcopy.
Cheers,
Trevor Sullivan
Reacted by Michael Klement, elirnm, Rob, Graham Mitchell, Chris Peterson, Pranay Kumar, Fotis Gimian, 柱子, Wallison Santos, formicant and 4 more
At this time the Clipboard cmdlets are not compatible with PSCore6 as it depends on a System.Windows.Forms class which isn't part of corefx and would not be cross platform compatible.
I do think the clipboard cmdlets are useful, but should be a separate module that is cross platform compatible which may require different code paths per OS.
changed the title [-]Set-Clipboard command missing from PowerShell Core Edition on Mac[/-][+]Get/Set-Clipboard command missing from PowerShell Core Edition on Mac[/+]on Apr 23, 2017
pbcopy/pbpaste should work. Trevor Sullivan (@pcgeek86) Have you investigated to see if this is an encoding problem? It would be nice if Out-Clipboard could just be an alias to pbcopy.
Activity
pcgeek86 commentedon Apr 21, 2017
Related ticket: #3177
iSazonov commentedon Apr 23, 2017
From Steve Lee (@SteveL-MSFT):
iSazonov commentedon Apr 23, 2017
Trevor Sullivan (@pcgeek86) Could you make the Issue more common and change the title to "Get/Set-Clipboard commands missing from PowerShell Core"?
[-]Set-Clipboard command missing from PowerShell Core Edition on Mac[/-][+]Get/Set-Clipboard command missing from PowerShell Core Edition on Mac[/+]BrucePay commentedon Apr 24, 2017
pbcopy/pbpaste should work. Trevor Sullivan (@pcgeek86) Have you investigated to see if this is an encoding problem? It would be nice if Out-Clipboard could just be an alias to pbcopy.
mklement0 commentedon Apr 25, 2017
It is indeed an encoding issue: because
$OutputEncodingdefaults to ASCII, any non-ASCII chars. are converted to literal?chars:3fis literal?(and0ais\n).If you set
$OutputEncodingto BOM-less UTF-8, it works:c3 b6is the UTF-8 encoding ofö, proving that the value was copied correctly.gradinkov commentedon Mar 29, 2018
Definitely a must have.
SteveL-MSFT commentedon May 22, 2018
Please use https://www.powershellgallery.com/packages/ClipboardText