怎样才能用Windows命令获取剪贴板内容?

例如,我可以像这样将文件复制到剪贴板

clip < file.txt 

(现在file.txt的内容在剪贴板中。)

我怎么能做相反的事情:

 ???? > file.txt 

所以剪贴板的内容将在file.txt

您可以使用paste.exe软件来粘贴文本,就像您所描述的一样。

http://www.c3scripts.com/tutorials/msdos/paste.html

有了它,你可以做到:

 paste | command 

将Windows剪贴板的内容粘贴到指定的命令提示符的输入中

要么

 paste > filename 

将剪贴板内容粘贴到指定的文件。

有双向工作的第三方剪辑命令。

这里有一个:

  CLIP - Copy the specified text file to the clip board Copyright (c) 1998,99 by Dave Navarro, Jr. (dave@basicguru.com) 

我有一对实用程序(从之前的剪辑命令是Windows的一部分)在此页面上可用:

http://www.clipboardextender.com/general-clipboard-use/command-window-output-to-clipboard-in-vista

这里有两个工具,Clip2DOS和DOS2Clip。 你想要Clip2DOS:

Clip2DOS版权所有2006 Thornsoft Development将剪贴板文本(1024字节)转储到标准输出。
用法:Clip2Dos.exe> out.txt结果:文本在文件中。 限制:1024字节。 许可证:免费,如免费啤酒! http://www.thornsoft.com/dist/techsupport/dos2clip.zip

德尔福来源包括!

嘿,这是(Clip2DOS.dpr):

 {Clip2DOS - copyright 2005 Thornsoft Development, Inc. All rights reserved.} program Clip2Dos; {$APPTYPE CONSOLE} uses Clipbrd, ExceptionLog, SysUtils; var p : Array[0..1024] of Char; begin try WriteLn('Clip2DOS Copyright 2006 Thornsoft Development'); Clipboard.GetTextBuf(p,1024); WriteLn(p); except //Handle error condition on E: Exception do begin beep; Writeln(SysUtils.format('Clip2DOS - Error: %s',[E.Message])); ExitCode := 1; //Set ExitCode <> 0 to flag error condition (by convention) end; end end. 

这是由Dave Navarro提供的CLIP程序,在@foxidrive的回答中提到。 这里有一篇文章提到: 从剪贴板复制到xywrite

下载链接以及许多其他资源位于此页面上: http : //www.lexitec.fi/xywrite/utility.html

这是一个直接链接到下载:“下载Clip.exe从Dave Navarro,Jr.复制到和剪贴板”

这个肮脏的窍门符合我的需求,它来自Windows!

 notepad.exe file.txt 

Ctrl + VCtrl + SAlt + FX