Have you ever felt the need for copying an output generated on command line to clipboard, or wanted to paste from clipboard to command line?您是否曾经感到需要复制一所产生的输出对命令行剪贴簿,或想从剪贴板粘贴到命令行?

The following java utilities (cross-platform) will help you do just that.下面的Java水电费(跨平台)将帮助您做到这一点。

Usage:用法:
=> To copy the output of a program to clipboard = >复制到输出的一个程序到剪贴板
echo Hello World | java ClipCopy回声的Hello World |手电clipcopy
dir | java ClipCopy迪尔|手电clipcopy

=> To paste the clipboard contents to a file = > ,以将剪贴板内容粘贴到一个文件
java ClipPaste > clip.txt Java的clippaste > clip.txt

This can also be used to remove the requirement to create temporary files in a complex batch/shell script.这也可以被用来移除的要求创建临时文件在一个复杂的批处理/ shell脚本。

To type clipboard contents directly from command line just type: java ClipCopy键入剪贴板内容直接从命令行只需键入: Java语言clipcopy
End with content with end character of your OS, Ctrl-Z for windows & Ctrl-D for Unix.结束与内容,与年底的性质您的操作系统,按Ctrl - Z的用于Windows &按Ctrl - D的UNIX的。

Download:下载:
ClipCopy.class clipcopy.class
ClipPaste.class clippaste.class

For line counters, ClipCopy is 4 lines of code and ClipPaste is 2 lines of code.线柜台, clipcopy是4行的代码和clippaste是2的代码行。 This doesn't take into account the import, class & main declarations and opening & closing braces.这并不顾及进口,阶级与主要的声明和开放与关闭牙套。

Let me know if you find this useful.让我知道,如果你觉得这是有益的。

Note: For non-Java users you might find it easier to download the注意:对于非Java用户,你会觉得更容易下载 jar file JAR文件 and run the modified commands as shown below:并运行该修改命令,如下所示:
Usage:用法:
=> To copy the output of a program to clipboard = >复制到输出的一个程序到剪贴板
echo Hello World | java -cp clip.jar ClipCopy回声的Hello World | Java的警务处处长clip.jar clipcopy
dir | java -cp clip.jar ClipCopy迪尔| Java的警务处处长clip.jar clipcopy

=> To paste the clipboard contents to a file = > ,以将剪贴板内容粘贴到一个文件
java -cp clip.jar ClipPaste > clip.txt Java的警务处处长clip.jar clippaste > clip.txt

This takes care of any classpath setting issue.这需要照顾的任何classpath下设置的问题。 You still need to have jre installed in your system.你还需要有JRE的安装在您的系统。

Limitation: Not tested with binary content.但不限于:尚未测试与二进制内容。 This is meant for text transfers only.这是指文字转让只。