How can I redirect the output of command prompt to DebugView on windows?

1.8k Views Asked by At

My idea is something like

C:\myprog.exe > DebugView

but instead of creating a file named "DebugView", I would like the output of myprog.exe to be captured by DebugView.

Any comment is highly appreciated!

3

There are 3 best solutions below

0
On

I believe what you are looking for is OutputDebugString()

0
On

You need to pipe it rather than redirect it:

C:\myprog.exe | DebugView

Of course, DebugView needs to read from standard input for this to work.

3
On

As David Heffernan explained above, you need to send the output through another program, whose task is to convert all standard input to debug output using OutputDebugString, as linuxuser27 noted. However, I am not aware of any already existing program for such a task. You might use the following simple C# program to do that:

public class StdinToDebug
{
    static void Main()
    {
        string line;
        while ((line = Console.ReadLine()) != null) Trace.WriteLine(line);
    }
}

If you compile it to e.g. StdinToDebug.exe, you can use the mentioned

C:\myprog.exe | StdinToDebug.exe