如何将windbg命令重定向到文件而不在windbg控制台上回显输出? [英] How to redirect windbg command to a file without echoing the output on the windbg console?

查看:29
本文介绍了如何将windbg命令重定向到文件而不在windbg控制台上回显输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.logopen 不是答案,因为它让命令输出到 windbg 控制台.

.logopen is not the answer, because it lets the command output to the windbg console.

例如,!sosex.dumpgen 2 会产生大量输出,我不想在调试器控制台中看到这些输出.现在我正在使用以下内容:

For example, !sosex.dumpgen 2 produces a helluva lot of output, which I do not want to see in the debugger console. Right now I am using the following:

.shell -i- -ci "!dumpgen 2" cmd /c more > D:\tmp\dumpgen2.log

我的问题是 more 命令是交互式的,在输出一定数量的数据后需要用户输入.这对我来说是个大问题.

My problem is that the more command is interactive and requires user input after outputting certain amount of data. This is a huge problem for me.

一种解决方案可能是使用脚本以非交互方式运行调试器本身,并在那里使用 .logopen 命令.

One solution could be running the debugger itself non interactively with a script and use the .logopen command there.

我想知道我是否可以同时实现我想要的:

I wonder if I could achieve what I want while:

  1. 从交互式 WinDbg 会话中执行此操作
  2. 使用普通的标准 shell 命令(也可以是 cmd.exe 或 powershell.exe).我知道编写一个只是将 stdin 转发到 stdout 的小实用程序是一项微不足道的工作,但我还是不想这样做.

推荐答案

.shell -i- -ci "!dumpgen 2" findstr "^" >D:\tmp\dumpgen2.log

^ 会找到任何一行的开头,所以它应该是一个 1:1 的副本.

^ will find the beginning of any line, so it should be a 1:1 copy.

这篇关于如何将windbg命令重定向到文件而不在windbg控制台上回显输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆