Gor*_*ean 10 clipboard windows-subsystem-for-linux
使用适用于 Windows 的 Linux 子系统 (LSW),clip.exe
可用于将数据复制到 Windows 剪贴板:
$ 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.
Run Code Online (Sandbox Code Playgroud)
有没有办法从剪贴板管道?预期用途示例:
$ paste.exe > foo.txt
$ paste.exe | tr , '\n' | clip.exe
Run Code Online (Sandbox Code Playgroud)
Non*_*uit 13
解决方案
这会将 Windows 的剪贴板打印到标准输出:
powershell.exe Get-Clipboard
Run Code Online (Sandbox Code Playgroud)
例子
$ echo "hello" | clip.exe
$ powershell.exe Get-Clipboard
hello
Run Code Online (Sandbox Code Playgroud)
$ date +%Y-%m-%d | clip.exe
$ powershell.exe Get-Clipboard
2019-06-13
Run Code Online (Sandbox Code Playgroud)
$ alias paste.exe='powershell.exe Get-Clipboard'
$ echo "world" | clip.exe
$ paste.exe
world
Run Code Online (Sandbox Code Playgroud)
来源:https : //github.com/Microsoft/WSL/issues/1069#issuecomment-391968532
归档时间: |
|
查看次数: |
1421 次 |
最近记录: |