How do I use a pipe to redirect the output of one command to the input of another?
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%"
This should work:
for /F "tokens=*" %i in ('temperature') do prismcom.exe usb %i
If running in a batch file, you need to use %%i
instead of just %i
(in both places).
You can also run exactly same command at Cmd.exe command-line using PowerShell. I'd go with this approach for simplicity...
C:\>PowerShell -Command "temperature | prismcom.exe usb"
Please read up on Understanding the Windows PowerShell Pipeline
You can also type in C:\>PowerShell
at the command-line and it'll put you in PS C:\>
mode instanctly, where you can directly start writing PS.