使用 Windows 終端機將資料從 Linux 控制台複製到 Windowshost 剪貼簿

使用 Windows 終端機將資料從 Linux 控制台複製到 Windowshost 剪貼簿

我正在使用 Windows 終端機存取我的 Linux 機器,並且需要將資料從 Linux 控制台複製到 Windows 主機剪貼簿,這可能嗎?

更具體地說,我在 Linux 上運行一個 .Net core 應用程序,它需要將字串複製到剪貼簿。

答案1

從 Linux shell:

printf $'\e]52;c;%s\a' "$(base64 <<<'hello world')"

答案2

我根據 @MrCalvin 的精彩答案創建了這個小腳本:

# clipfile
#  - Sends a file into the windows terminal clipboard
printf $'\e]52;c;%s\a' "$(base64 ${1:?})"

將檔案複製到剪貼簿以便貼上到 Windows 應用程式中,這為我節省了大量時間。

相關內容