The !for_each_local extension executes a debugger command one time for each local variable in the current frame.

!for_each_local ["CommandString"] 
!for_each_local -? 


Specifies the debugger commands to execute one time for each local variable in the current stack frame. If CommandString includes multiple commands, you must separate them with semicolons and enclose CommandString in quotation marks. If you include multiple commands, the individual commands in CommandString cannot contain quotation marks.

Within CommandString, or within any script that the commands in CommandString execute, you can use the @#Local alias. This alias is replaced by the name of the local variable. This replacement occurs before CommandString is executed and before any other parsing occurs. This alias is case sensitive, and you must add a space before it and add a space after it, even if you enclose the alias in parentheses. If you use C++ expression syntax, you must reference this alias as @@( @#Local ).

This alias is available only during the lifetime of the call to !for_each_local. Do not confuse this alias with pseudo-registers, fixed-name aliases, or user-named aliases.

Displays some Help text for this extension in the Debugger Command window.


Windows 2000


Windows XP and later


Additional Information

For more information about how to display and change local variables and a description of other memory-related commands, see Reading and Writing Memory.


If you do not specify any arguments, the !for_each_local extension lists local variables. For more information about the local variables, use the dv (Display Local Variables) command.

If you enable verbose debugger output, the display includes the total number of local variables when the extension is called, and every time that CommandString is executed for a local variable, that variable and the text of CommandString are echoed.