How do I use a pipe to redirect the output of one command to the input of another?

Austin Burk picture Austin Burk · Jan 29, 2013 · Viewed 107.2k times · Source

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

prismcom.exe

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.

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

temperature | prismcom.exe usb

This does not seem to work.

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.

Thanks!

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

Answer

Kenny Kerr picture Kenny Kerr · Jan 29, 2013

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%"