如何使用管道将一个命令的输出重定向到另一个命令的输入? [英] How do I use a pipe to redirect the output of one command to the input of another?

查看:355
本文介绍了如何使用管道将一个命令的输出重定向到另一个命令的输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个将文本发送到LED标牌的程序.

I have a program which sends text to an LED sign.

prismcom.exe

prismcom.exe

要使用该程序发送"Hello":

To use the program to send "Hello":

prismcom.exe usb Hello

现在,我希望使用例如称为温度的命令程序.

Now, I wish to, for example use a command program called Temperature.

temperature

比方说,该程序可以确定计算机的温度.

Let's say the program gives your computer's temperature.

Your computer is 100 degrees Fahrenheit.

现在,我想将温度的输出写到prismcom.exe:

Now, I wish to write the output of temperature to prismcom.exe:

temperature | prismcom.exe usb

这似乎不起作用.

是的,我一直在寻找解决方案超过二十分钟.在所有情况下,它们要么是恶意软件,要么是Windows命令行以外的解决方案.

Yes, I've looked for a solution to this for more than twenty minutes. In all cases, they are either kludges/hacks or a solution for something besides the Windows command line.

对于将温度的输出通过管道传输到棱柱形棱镜的方式,我会感到很感激.

I would appreciate direction as to how I would pipe the output from temperature to prismcom.

谢谢!

Prismcom有两个参数.第一个永远是'usb'.此后出现的所有内容都将显示在标牌上.

Prismcom has two arguments. The first will always be 'usb'. Anything that comes after that will be displayed on the sign.

推荐答案

尝试一下.将其复制到批处理文件(例如send.bat)中,然后只需运行send.bat即可将消息从温度程序发送到Prismcom程序.

Try this. Copy this into a batch file - such as send.bat - and then simply run send.bat to send the message from the temperature program to the prismcom program.

temperature.exe > msg.txt
set /p msg= < msg.txt
prismcom.exe usb "%msg%"

这篇关于如何使用管道将一个命令的输出重定向到另一个命令的输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆