How can I get a script's output to be copied t

2019-04-09 06:40发布

I find myself running scripts and copy-pasting the output of these runs into emails or into some other documents. Is there a way such that I can make the copy-to-clipboard step a part of the script itself? Most of my scripts are either Perl or bat files and I work on Windows.

Thanks.

3条回答
smile是对你的礼貌
2楼-- · 2019-04-09 06:49

There's a utility called clip.exe that you can use. Just pipe the output of your script or any other command into clip.exe (First, put it on your path somewhere. If you don't have a usual place for these kindss of utilities, you can dump it in the directory you usually run your scripts from, or I've known people to use c:\Windows\system32 in a pinch...):

somescript.bat | clip

Then paste away.

查看更多
对你真心纯属浪费
3楼-- · 2019-04-09 06:58

In Perl, install and use Win32::Clipboard module

查看更多
Emotional °昔
4楼-- · 2019-04-09 06:59

Not sure about the clipboard but you can pipe the output to a text file but doing something like this:

somescript.bat > output.txt
查看更多
登录 后发表回答