开发者

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

My idea is something like

C:\mypr开发者_Python百科og.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!


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


I believe what you are looking for is OutputDebugString()


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜