PowerShell 6.2.4:Get-Clipboard'无法识别为cmdlet的名称

时间:2020-01-30 19:55:33

标签: powershell clipboard

我希望Get-Clipboardthis开始工作

我正在使用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

1 个答案:

答案 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}}。

    • 该模块还可以与 Windows PowerShell v2-v4 版本一起使用,该版本同样缺少剪贴板实用程序。
相关问题