---
title: "executeCommands(in:with:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlcomputecommandencoder/executecommands(in:with:)"
---

# executeCommands(in:with:)

Encodes an instruction to run commands from an indirect buffer.

## Declaration

```swift
func executeCommands(in indirectCommandBuffer: any MTLIndirectCommandBuffer, with executionRange: NSRange)
```

## Parameters

- `indirectCommandBuffer`: The doc://com.apple.metal/documentation/Metal/MTLIndirectCommandBuffer instance containing the commands to execute.
- `executionRange`: The range of commands to execute. The maximum length of the range is 16384 commands.

## See Also

### Dispatching from indirect command buffers

- [dispatchThreadgroups(indirectBuffer:indirectBufferOffset:threadsPerThreadgroup:)](metal/mtlcomputecommandencoder/dispatchthreadgroups(indirectbuffer:indirectbufferoffset:threadsperthreadgroup:).md)
- [executeCommandsInBuffer(_:range:)](metal/mtlcomputecommandencoder/executecommandsinbuffer(_:range:).md)
- [executeCommandsInBuffer(_:indirectBuffer:offset:)](metal/mtlcomputecommandencoder/executecommandsinbuffer(_:indirectbuffer:offset:).md)
- [executeCommands(in:indirectBuffer:indirectBufferOffset:)](metal/mtlcomputecommandencoder/executecommands(in:indirectbuffer:indirectbufferoffset:).md)
