我正在尝试在 Windbg 脚本文件中创建一个文件夹。如果我只打开windbg,我可以使用
.shell -ci "*" mkdir C:\mydir
来完成。但是,如果我在 Windbg 脚本中输入完全相同的命令,则会收到错误 The command line is too long
,并使用 Process Monitor 查看,我发现 Windbg 将整个脚本传递给 cmd.exe,而不仅仅是我的命令。
调试器命令.txt
.echo *** before mkdir ***
.shell -ci "*" mkdir C:\mydir
.echo *** after mkdir ***
$$ many other debugger commands saving stuff to c:\mydir...
命令:
windbg -c '$$>< DebuggerCommands.txt' notepad.exe
结果 - Windbg 打开并显示:
0:000> $$>< DebuggerCommands.txt
*** before mkdir ***
The command line is too long.
.shell: Process exited
0:000>
在 Process Monitor 中,我看到
C:\Windows\system32\cmd.exe /c "mkdir C:\mydir;.echo *** after mkdir ***;$$ many other debugger commands...
等。