我希望Get-Clipboard
从this开始工作
我正在使用PowerShell 6.2.4和MacOs Catalina吗?
Get-Clipboard : The term 'Get-Clipboard' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At /Users/.../debug.ps1:41 char:1
+ Get-Clipboard
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-Clipboard:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
答案 0 :(得分:1)
PowerShell [Core] v6.x没有否剪贴板cmdlet-您必须等待v7.0 才能返回(可用的预览版本具有它们) )。
documentation URL in your link以?view=powershell-7
结尾,表示v7.x主题; 有一个标记为“版本”的下拉列表,用于选择其他PowerShell版本;如果您选择了6
,则将被告知v6.x不存在这样的页面
与此同时,您有两个选择:
使用特定于平台的工具,例如pbpaste
/ pbcopy
(macOS)和xclip
(具有基于X11的桌面的Linux发行版)和clip.exe
/ Windows上的System.Windows.Forms
程序集。
使用ClipboardText
第三方模块(由我编写; repo),该模块为您包装了上述工具(仅通过命令Set-ClipboardText
和{ {1}}。