Skip to main content
The 2024 Developer Survey results are live! See the results

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • Unfortunately, this is far past overkill for my particular task. If I wanted to use a POSIX emulation layer, I'd just use MSYS or cygwin. Also, tee itself doesn't help - it's the ability to redirect to the tty or output device as if it were a file, which is something POSIX provides, not the tee command.
    – Bob
    Commented Jun 12, 2014 at 2:35
  • TCC can do just that: echo ee|tee con:|foo - I tested with the following command for /l %n in (1,1,10) do ( echo %n %+ delay)|tee con:|nl. Here NL is a program which gives a numbered listing, and the output was interspersed unnumbered and numbered lines. The 1 second delay allowed me to see that both the console and the pipe reader were receiving lines simultaneously. Sorry you feel it's overkill: I would not be without TCC.
    – AFH
    Commented Jun 12, 2014 at 10:15
  • Right - it would be great if you could include that in your answer (it's not immediately obvious that it provides some way to reference the console). Still overkill for my case, since I'm trying to create a build script to be committed to version control for other people to use, so I'd like to minimise third party software I'd need to bundle (if the licence even allows redis). A small binary like Benji's answer is acceptable, an entire command interpreter I'd need to install is too much. It could be useful for other people, though.
    – Bob
    Commented Jun 12, 2014 at 11:44
  • Good point. I have updated my answer as you suggest, and I can see that Benji's solution could be a good fit for your specific need, but I thought I would test it, and I found that you need to add fflush(NULL); after the fprintf() line, in order to see the output in real-time. If you are in a commercial environment, you cannot use TCC without buying appropriate licences.
    – AFH
    Commented Jun 12, 2014 at 12:37