Command Items (or item commands) allows you to generate items with commands linked to them using NBT data.
This picture shows what happens when you generate an item without the console prefix, which makes the player execute the command.
This shows what happens when you generate an item with the console prefix (c:), which makes the command get executed on the console.