← Back to Command Directory ← Back to Home

/execute

Changes execution context and runs a command.

Syntax

/execute as  at  run 

Parameters

NameRequiredDescription
targetYesEntity to execute as/at.
commandYesCommand to run under the new context.

Examples

/execute as @a at @s run say Hello
/execute if block ~ ~-1 ~ minecraft:diamond_block run say On diamond

Notes

Version Differences

Major syntax overhaul occurred in Java 1.13.

Related Commands