使用(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.有什么方法可以从剪贴板的上输送吗?打算使用的例子:
$ paste.exe > foo.txt
$ paste.exe | tr , '\n' | clip.exe发布于 2019-06-13 15:36:10
溶液
这会将Windows的剪贴板打印到stdout:
powershell.exe Get-Clipboard示例
$ 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
worldpaste() { # Add me to your .bashrc, perhaps.
powershell.exe Get-Clipboard | sed 's/\r//'
# The `sed` will remove the unwelcome carriage-returns
}来源:https://github.com/Microsoft/WSL/issues/1069#issuecomment-391968532
https://stackoverflow.com/questions/55974462
复制相似问题