# P_commandtoeach
## Syntax:
@commandtoeach**({groupmath}, {command})**
## Use Case:
Iterates through each active session matching the specified groupmath expression and executes the command locally for each one. During execution, the session name is stored in the '$ListItem' variable.
## Arguments:
- **{groupmath}**: A groupmath expression (e.g. `ALL`, `Tanks`, `Tanks+Healers`, `ALL-Tanks`, or comma-separated lists like `Tanks, Healers`).
- **{command}**  : The command to run locally for each session name (use semicolon for multiple).
## Examples:
1. **@commandtoeach(Healers+Tanks, /showme Active Session: $ListItem)**
2. **@commandtoeach(ALL-Tanks, /window {$ListItem} say Hi from the rest of the group!)**
## See Also:
delegate, cycle, commandtolist
