ArtemisPvPMinecraft Wiki Artemis PvP Wiki

Updated 25 October 2026. Facts on this page come from minecraft.wiki, minecraft.net and the live Artemis PvP server; sources are listed at the bottom.

Minecraft /execute Command Explained With Examples
General Minecraft

Minecraft /execute Command Explained With Examples

/execute runs another command as a different entity, at a different place, or only if a condition is true, by chaining subcommands and ending with run. For example, /execute as @e[type=zombie] at @s run summon lightning_bolt strikes every zombie. Java has 14 subcommands, Bedrock 11; it needs cheats or operator rights.

What are the parts of /execute?

SubcommandWhat it doesEdition
asRuns as each chosen entity (changes who @s is)Both
atRuns at each chosen entity's position and rotationBoth
positioned, rotated, facing, align, anchoredChange position or directionBoth
inRuns in another dimensionBoth
if / unlessOnly continues if a block, entity, score or other test passesBoth
onSwitches to a related entity, such as the rider or ownerJava
summonSummons an entity and runs as itJava
storeSaves the result into a score, NBT or a bossbarJava
runThe command to run, always lastBoth

Subcommands are read left to right, so order matters: as @e at @s runs at each entity, while at @s as @e runs every entity at your position.

What are useful /execute examples?

CommandResult
/execute as @a at @s run tp ~ ~1 ~Lifts every player 1 block
/execute in minecraft:the_nether run tp @s 0 70 0Teleports you to coordinates in the Nether (Java)
/execute if block ~ ~-1 ~ diamond_block run say on diamondRuns only if you stand on a diamond block
/execute as @e[type=zombie] at @s run summon lightning_boltLightning on every zombie
/execute unless entity @e[type=creeper,distance=..10] run say safeRuns if no creeper is within 10 blocks (Java)

Selectors such as @e[type=zombie] are explained in target selectors.

Where is /execute used most?

In command blocks and functions that run every tick: checking where players stand, giving effects in an area, or running minigame logic. Combined with scoreboards it can count kills or time. See command blocks and /scoreboard.

How is it different on Bedrock?

Bedrock got the same newer syntax in 1.19.50 but lacks on, summon and store, and it processes a forked chain depth-first while Java goes breadth-first, so some complex chains act differently. See Bedrock commands.

Which commands can players use on ArtemisPvP?

Everyday ones such as /spawn, /home, /tpa, /back and /rtp; see Essentials.

Frequently asked questions

What does /execute as @a at @s mean?

Run the following command once for each player, at that player's position.

Can /execute change dimension?

Yes, with the in subcommand, for example /execute in minecraft:the_nether run ...

Sources

Every fact on this page was checked against these pages; the wording is ours.