A minecart with command block is an impulse[JE only] or repeating[BE & edu only]command block inside a minecart.
Obtaining
The minecart with command block is obtainable only using the command/give @s command_block_minecart, as it does not appear in the creative inventory[Bedrock Edition only] and has no crafting recipe. It can also be summoned using the command /summon command_block_minecart. It can be broken like any other form of minecart, but doing so will only drop a minecart, losing the command block.
The minecart with command block combines the functionalities of both minecarts and command blocks. Although the minecart visually contains an impulse command block in Java Edition, it functions more similarly to a repeating command block, executing the command once every four game ticks (unlike a repeating command block that repeats every 1 game tick) when on an active activator rail. When it passes over a detector rail with a comparator connected next to it, it outputs the command block's success count value.
The command is executed at the coordinates of the minecart, which can of course move, allowing for command execution relative to an entity without the /execute command.
Tags common to all entities see Template:Nbt inherit/entity/template
Tags common to all minecarts see Template:Nbt inherit/vehicle/template
[String] Command: The command entered into the minecart.
[String] LastOutput: The last line of output generated by the minecart. Still stored even if the gamerule commandBlockOutput is false. Appears in the GUI of the minecart when right-clicked, and includes a timestamp of when the output was produced.
[Int] SuccessCount: Represents the strength of the analog signal output by redstone comparators attached to this minecart. Only updated when the minecart is activated with an activator rail.
[Boolean] TrackOutput: 1 or 0 (true/false) - Determines whether the LastOutput is stored. Can be toggled in the GUI by clicking a button near the "Previous Output" textbox. Caption on the button indicates current state: "O" if true,"X" if false.
Moved the minecart with command block behind the Operator Utilities tab in the creative inventory. The tab is only available if cheats are enabled and the "Operator Items Tab" option in the controls menu is turned on.