O'Reilly logo

Windows Debugging Notebook: Essential User Space WinDbg Commands by Dmitry Vostokov, Roberto Alexis Farah

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

.foreach

This is by far one of the most powerful WinDbg commands. Even if we don't create scripts we will benefit from this command. It is powerful because it is flexible. We can use it for a huge variety of operations. It parses the output of debugger commands (InCmds, String or FileName) and uses each output value as the input to other commands (OutCmds).

Syntax

.foreach [Options ] (  Var   {  InCmds  } ) {  OutCmds  } 
.foreach [Options ] /s (  Var   " String " ) {  OutCmds  } 
.foreach [Options ] /f (  Var   " FileName " ) {  OutCmds  } 

Options can be:

/pS InitSkipNum

to skip the number of initial tokens and

/ps  SkipNum 

to skip the number of tokens repeatedly.

It may look complicated. To help in understanding the variations, below are several ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required