开发者

Have a Linux shell script stuff a string into a Windows user's copy/paste buffer

开发者 https://www.devze.com 2022-12-21 23:47 出处:网络
We have a script right now which our Windows users run on a Linux host by way of putty.From time to time the script produces a string that the user must copy and paste into a Windows application.

We have a script right now which our Windows users run on a Linux host by way of putty. From time to time the script produces a string that the user must copy and paste into a Windows application.

Without running a full-blown X display server on the Windows box, I'd like to modify the script so that the string is populated in the Windows user's copy/paste buffer automatically so that it's more convenient for the user and so that we reduce the error rate (the workflow is clumsy enough, we'd like to make it a little less so).

Here's what I don't consider solutions:

  1. Running a full blown X display manager on the Windows side just for this (if there exists a nearly invisible utility that enables just this one feature that's a different story)
  2. Make the user stop running Windows
  3. Rewrite any other applications

I have full control over the Windows user's environm开发者_开发百科ent (can set up whatever putty settings I need to) as well as the Linux host and every node in the network between the two.


If I had to do this I'd probably grab the sources to putty and modify it to suit.

Failing that I don't think you'll be able to easily do this; except by writing a small script on the Linux box that will open a socket to the a small windows deamon and send the text across to be put into the Windows clipboard.


If the remote script doesn't need full terminal support but only does simple stdin/stdout operation, then you might be able to use plink to provide a simple text-only interface which can probably be scripted more easily than a full PuTTY window.


http://ericmason.net/2010/04/putty-ssh-windows-clipboard-integration/

This guy's script patches putty to just what was suggested above. I think it would be more elegant to have just a printer driver you can install in windows to get text to the clipboard, rather than patching putty, but this works!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号