Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Windows console:

  • Tool A can write binary data to a file, but has no option for telling it to use stdout.
  • Tool B can read binary data from stdin and process the info in it.

How can I get the output from A piped through B without using an intermediate file?

In other words: what is the Windows equivalent of /dev/stdout?


share|improve this question

Windows does have an analogue for /dev/stdout, CON:

I imagine it still works, considering Microsoft's ongoing "legacy compatibility" program.

Ah.. found it. Microsoft Support gives a list of reserved names. You cannot name a file these names, and they have special meanings when used as inputs or outputs.

You MIGHT be able to use CON as an output device to send to stdout.

The list:

   Name    Function
   ----    --------
   CON     Keyboard and display
   PRN     System list device, usually a parallel port
   AUX     Auxiliary device, usually a serial port
   CLOCK$  System real-time clock
   NUL     Bit-bucket device
   A:-Z:   Drive letters
   COM1    First serial communications port
   LPT1    First parallel printer port
   LPT2    Second parallel printer port
   LPT3    Third parallel printer port
   COM2    Second serial communications port
   COM3    Third serial communications port
   COM4    Fourth serial communications port
share|improve this answer
Thanks, it really works (even in Win 8.1). We run build with Unity, in batch mode: Unity.exe -batchmode -projectPath C:\***\Application -logFile -buildWebPlayer web -quit. Without argument (filename) to -logFile - it must print output to console, but it doesn't. After adding CON (i.e. - -logFile CON) - it does :-) – setevoy Apr 15 '15 at 11:21

Windows has no direct equivalent to /dev/stdout.

Here is my attempt at writing a C# program that creates a named pipe, which can be given to program A as a filename. Requires .NET v4.

(C# because the compiler comes with .NET runtime, and what computer doesn't have .NET these days?)

share|improve this answer
+1 Now that is a cool solution! I will try that soon and let you know. Now first some Zzzzzzz :-) – Jeroen Wiert Pluimers Feb 3 '11 at 21:46
One more thought before doing Zzzz: what about closing the pipe? I'm going to think about what the best signalling mechanism is for programone to tell pipe, that it is done with \\.\pipe\foo – Jeroen Wiert Pluimers Feb 3 '11 at 21:55
@Jeroen: When programone is done outputting data, it will simply close the output file it was using. (From the client side, pipes work the same way as ordinary files.) When it does so, pipe.exe – more precisely, pipe.CopyTo(...) – will reach EOF and simply exit. – grawity Feb 3 '11 at 22:03
@Jeroen: Also, there's one thing I haven't figured out: when using the tool in the opposite (out) direction (copy stdin to pipe), it dies with "Broken pipe" error after the first 1 kB. Doesn't happen when copying a pipe to stdout (in), however, so it shouldn't affect your program. (As they say, patches welcome.) – grawity Feb 3 '11 at 22:13
thanks will try this later next week, something in the project came up with a higher prio (don't you love IT projects <g>) – Jeroen Wiert Pluimers Feb 4 '11 at 11:32

Based on grawity's answer I've created an extended version which allows a process to be started directly without having to use multiple terminal windows.

General usage:

PipeServer [in|out] [process name] [argument 1] [argument 2] [...]

The string "{pipe}" is then replaced by the redirection path.

Real-World example:

PipeServer.exe in "C:\Keil\UV4\Uv4.exe" -b "C:\Project\Project.uvproj" -j0 -o "{pipe}"

This command-line can be inserted directly into, for example, Eclipse to redirect the build log of a certain external builder to StdOut.

This is probably the best it gets...


share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .