我想做类似的事情
dir *.* > clipboard
即。获取获取复制到剪贴板的命令行程序的标准输出。可以在没有其他程序的标准XP计算机上完成此操作吗?
我想做类似的事情
dir *.* > clipboard
即。获取获取复制到剪贴板的命令行程序的标准输出。可以在没有其他程序的标准XP计算机上完成此操作吗?
Answers:
我不这么认为-Vista(或NT4)引入了该clip
工具,该工具可以按照您的命令进行操作dir | clip
-但XP上没有任何功能。但是,如果您愿意使用第三方应用程序,则可以使用this,它的工作原理与上面相同,只是称为cb
,而不是剪辑。
对于Windows和非Windows,此帖子(无效链接)过去曾说过:
在Windows Vista或更高版本上,请尝试:
echo hello | clip
在Linux上,尝试:
echo hello | xclip
在Mac OS X上,尝试:
echo hello | pbcopy
例如,您可以这样做
(cat myFile.txt | xclip)
。基本上,这将使您可以直接编辑剪贴板。
(我是通过Google来到这里寻找与Mac相当的xclip
)
同样,对于文件的内容(因为您不在cat
Windows上):
type filename | clip % OR clip < filename %windows cat filename | xclip # OR xclip < filename # X11 / Unix / Linux cat filename | pbcopy # OR pbcopy < filename # MacOS X
pbcopy
,<kbd> Command </ kbd> + <kbd> V </ kbd>不会粘贴:您需要输入(或别名)pbpaste
。
我今天早些时候亲自研究了这个问题。以下是对那些希望在Linux发行版中的剪贴板中插入和检索信息的人的帮助。在此之下,可能会对带有Windows的用户有所帮助。
默认情况下,xclip使用“主要”剪贴板,这是您用鼠标复制的内容。要使其使用手动复制剪贴板,请改用xclip -sel剪辑。
在这里评论#3:http :
//ubuntuforums.org/showthread.php?t=413786
Active Perl发行版中也提供了该功能,这是我在本练习的Windows框上使用的功能;Windows clip.exe似乎不允许从剪贴板读取数据(仅写入剪贴板)。
没有标准方法,但是您显然可以使用clip.exe
Windows Server 2003资源工具包附带的方法。资源
现在,问题就变成了对此的合法副本。
Windows用户可以gclip.exe
作为一大批工具的一部分,这使您可以做到这一点。
在PowerShell中,可以这样完成:
dir *.* | clip
从Windows Vista和更高版本开始,DOS具有内置的clip命令:
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.
如果您在Windows上使用cygwin(例如Windows的git)。您最好将内容转储到临时文件中,然后在真正通过管道传递到“剪辑”之前先“ unix2dos”临时文件
clip
Windows XP上不存在。
pbcopy
和pbpaste
。