用于Windows的Linux子系统中的剪贴板中的管道 [英] Pipe from clipboard in linux subsytem for windows

查看:106
本文介绍了用于Windows的Linux子系统中的剪贴板中的管道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Windows的Linux子系统(LSW),可以使用 clip.exe 将数据复制到Windows剪贴板:

  $ clip.exe /? 

CLIP

描述:
将命令行工具的输出重定向到Windows剪贴板。
然后可以将此文本输出粘贴到其他程序中。

参数列表:
/?显示此帮助消息。

示例:
DIR | CLIP将当前目录
列表的副本放入Windows剪贴板。

CLIP< README.TXT将readme.txt
中的文本副本放置到Windows剪贴板上。

有什么方法可以传送 FROM 剪贴板吗?预期用途的示例:

  $ paste.exe> foo.txt 

$ paste.exe | tr,‘\n’| clip.exe


解决方案

解决方案



这会将Windows剪贴板打印到标准输出:

  powershell.exe获取剪贴板






示例

  $ echo hello | clip.exe 
$ powershell.exe剪贴板
你好



< pre class = lang-sh prettyprint-override> $ date +%Y-%m-%d | clip.exe
$ powershell.exe获取剪贴板
2019-06-13



  $别名paste.exe ='powershell.exe Get-Clipboard'
$ echo world | clip.exe
$ paste.exe
世界

源: https://github.com/Microsoft/WSL/issues/1069#issuecomment- 391968532


Using the Linux Subsystem for Windows (LSW), clip.exe can be used to copy data to the windows clipboard:

$ clip.exe /?

CLIP

Description:
    Redirects output of command line tools to the Windows clipboard.
    This text output can then be pasted into other programs.

Parameter List:
    /?                  Displays this help message.

Examples:
    DIR | CLIP          Places a copy of the current directory
                        listing into the Windows clipboard.

    CLIP < README.TXT   Places a copy of the text from readme.txt
                        on to the Windows clipboard.

Is there any way to pipe FROM the clipboard? Examples of intended use:

$ paste.exe > foo.txt

$ paste.exe | tr , '\n' | clip.exe

解决方案

Solution

This prints the Windows' clipboard to stdout:

powershell.exe Get-Clipboard


Examples

$ echo "hello" | clip.exe
$ powershell.exe Get-Clipboard
hello

$ date +%Y-%m-%d | clip.exe
$ powershell.exe Get-Clipboard
2019-06-13

$ alias paste.exe='powershell.exe Get-Clipboard'
$ echo "world" | clip.exe
$ paste.exe
world

source: https://github.com/Microsoft/WSL/issues/1069#issuecomment-391968532

这篇关于用于Windows的Linux子系统中的剪贴板中的管道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆