How to escape quotation marks in WinDbg's startup command line opening a dump

独自空忆成欢 提交于 2020-01-04 20:41:10

问题


Following this answer, I'm trying to set up a .dmp shell command in the Registry using the -c "..." switch to execute commands whenever I open a dump file.

While this works for any commands not using quotation marks, I'd now like to use a command which needs quotation marks. How can I escape the quotation marks to that they are not seen as the end of the -c "..." switch?

I tried:

  • escaping with a backslash \"
  • escaping by doubling the quotation marks ""

Details are :

Registry key: HKEY_CLASSES_ROOT\Windbg.DumpFile.1\shell\WinDbgStartup\command

(Default) value (working): "C:\path to\windbg.exe" -z "%1" -Q -c ".echo Welcome"

(Default) value (broken): "C:\path to\windbg.exe" -z "%1" -Q -c ".echo Wel""come"

-z is for opening a dump file, -Q is for quiet workspaces, at -c I can enter commands and I want to include quatation marks.

Error message: The command line arguments cannot specify more than one kind of debugging to start

WinDbg Version: 6.2.9200.16384 X86


回答1:


Have you tried ^" ? ^ escapes most characters in cmd


(On investigation)

Quote fromWinDbg Command-Line Options

-c " command "

    Specifies the initial debugger command to run at start-up. This command must be 
    enclosed in quotation marks. Multiple commands can be separated with semicolons. 
    (If you have a long command list, it may be easier to put them in a script and 
    then use the -c option with the $<, $><, $><, $$>< (Run Script File) command.)

    If you are starting a debugging client, this command must be intended for the 
    debugging server. Client-specific commands, such as .lsrcpath, are not allowed.

And clicking on the $... hyperlink further explains these options.

Seems that you actually want to include the " in your echo. Frankly, I've no idea - but what I'd try would be -c ".echo Wel^"come"

and if that doesn't work, I'd go off to the $-option gobbledegook. No-one (sane) ever claimed that every possibility had been considered in constructing these facilities...



来源:https://stackoverflow.com/questions/20990462/how-to-escape-quotation-marks-in-windbgs-startup-command-line-opening-a-dump

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!