Set-Clipboard is missing -AsHtml
See original GitHub issuePrerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
Set-Clipboard is missing -AsHtml in PS 7+
There is no known workaround or alternative for this incredibly useful feature.
Expected behavior
"<table><tr><td>Test</td><td>Test</td></tr></table>" | Set-Clipboard -AsHtml
Should produce a table for any rich-text enabled Office application (Word, Outlook, OneNote) and maybe other applications that understand this.
Actual behavior
-AsHtml does not exist. Piping into |ConvertTo-Html
does not work
Plain-text paste: <table><tr><td>Test</td><td>Test</td></tr></table>
Error details
Set-Clipboard: A parameter cannot be found that matches parameter name 'AsHtml'.
Environment data
Name Value
---- -----
PSVersion 7.2.6
PSEdition Core
GitCommitId 7.2.6
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Issue Analytics
- State:
- Created a year ago
- Comments:21 (8 by maintainers)
Top Results From Across the Web
Set-Clipboard (Microsoft.PowerShell.Management)
Indicates that the cmdlet renders the content as HTML to the clipboard. Type: SwitchParameter. Position: Named. Default value: None. Accept pipeline input: ...
Read more >How to set clipboard's plain text and html part at the same ...
html" | Set-Clipboard -AsHtml will set the html part and flush the plain text part of clipboard, so that using Get-Clipboard will get...
Read more >Some short Powershell tips #1
But I just want to paste the data on a sheet somewhere I liked. There is a cool cmdlet called: Set-Clipboard. PS H:\>...
Read more >Using PowerShell Copy to Clipboard Function
Set-Clipboard Powershell Command. Set-Clipboard replaces clip.exe but behaves exactly the same. Now, instead of piping output to clip, you can ...
Read more >Set-Clipboard for PowerShell 7
I know the ClipboardText module exists, but I really wanted something that brought back the 'file' copy and paste functionality (as well as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
There are two primary reasons (a) The code is something which cannot be open sourced, for whatever reason and (b) for some reason it was supported in .NET Framework but is not longer available in current .NET (and WHY? is a valid question there). Clipboard support went away in V6 for .NET related reasons, and came back in V7; I think in V7 it may be different code, or possibly just the subset of code which works cross platform . Sometimes teams in Microsoft do re-invent the wheel rather than using something from another group, but I don’t think is what is happening here.
I believe the reasoning on why this no longer exists has been answered. I would also encourage folks to publish a clipboard module to PSGallery whether it’s Windows only or, preferably, cross-platform. The built-in one as part of PS7 is intentionally limited to have it cross-platform.