WinDbg User mode / application debugging Create Custom Command Window in Windbg


Example

The .cmdtree command allows to open a .txt file with predefined commands which you can simply double click to execute.

How to create command file

Create the file using this template

windbg ANSI Command Tree 1.0    
title {"Window title"}
body
{"Group Heading"}
 {"Name of command to display"} {"command"}
 {"Name of command to display"} {"command"}
{"Group Heading"}
 {"Name of command to display"} {"command"}

Things to take care

  1. The template format should be followed precisely for opening the file in Windbg.
  2. The newline is required after each {Group Heading}.
  3. Each {Name of command to display} {command} pair should be in one line and should be followed by a new line.

Example of custom command file

windbg ANSI Command Tree 1.0    
title {"Your title goes here"}
body
{"Basic commands"}
 {"Show CLR Version"} {"lmv m clr"}
 {"Load SOS from CLR"} {".loadby sos clr "}
{"Symbols"}
 {"Load my symbols"} {".sympath+ "c:\DebugSymbols" ; .reload"}

How to open command UI from command window

Execute .cmdtree <path of your .txt file> to open the window. You will see a window like this

enter image description here

Double click on the command to execute.