问题
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