Syntax to add multiple commands to a single command block

Syntax to add multiple commands to a single command block - Unrecognizable woman holding paw of dog

I am looking to try and set multiple commands in a single command block, but so far everything I have tried just returns "Unknown Command".

What is the format for writing multiple commands in a single command block in Minecraft 1.8?

Can I use either of the following:

Command:(command here) Command:(command here)
/command here; /command here;

Or is there another format?



Best Answer

You cant write multiple commands in one command block but you can use one command to spawn more command blocks. If you mess around with the Riding datatag you can get fallingsand entities with commands in them to ride on top of each other. For example:

/summon Falling sand ~ ~2 ~ {Time:1,TileID:137,TileEntityData:{Command:/say hi},Riding:{id:FallingSand,Time:1,TileID:137,TileEntityData:{Command:/say hello}} 

Now if you want them to activate simultaneously you could do something like

/summon FallingSand ~ ~1 ~ {Block:redstone_block,Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:"/fill ~ ~0 ~1 ~ ~-4 ~1 redstone_block"},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~ ~3 ~1 stone},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~ ~4 ~ command_block 0 replace {Command:fill ~ ~2 ~ ~ ~-8 ~1 air}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:"/say Hello"},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:"/say Hi"},Time:1,Riding:{id:"FallingSand",Block:stone,Time:1}}}}}}}

This is the only way to get multiple commands in one command block, if you know how FallingSand works this would make a lot more sense, hope this helps.




Pictures about "Syntax to add multiple commands to a single command block"

Syntax to add multiple commands to a single command block - Side view of young woman in hoodie sitting on floor near sofa and playing with obedient brown Labrador while resting during free time
Syntax to add multiple commands to a single command block - Crop hacker silhouette typing on computer keyboard while hacking system
Syntax to add multiple commands to a single command block - Full body optimistic young female with curly hair smiling and teaching Beagle dog beg command on sunny summer day in countryside



How do you add multiple commands?

There are 3 ways to run multiple shell commands in one line:
  • 1) Use ; No matter the first command cmd1 run successfully or not, always run the second command cmd2: ...
  • 2) Use && Only when the first command cmd1 run successfully, run the second command cmd2: ...
  • 3) Use ||


  • How do you run multiple commands in one command block in Linux?

    On Linux, there are three ways to run multiple commands in a terminal: The Semicolon (;) operator....
  • Using the Semicolon (;) Operator. ...
  • Using the OR (||) Operator. ...
  • Using the AND (&&) Operator.


  • How do you run multiple commands with execute?

    Try using the conditional execution & or the && between each command either with a copy and paste into the cmd.exe window or in a batch file. Additionally, you can use the double pipe || symbols instead to only run the next command if the previous command failed.



    Run multiple commands with one command block! | *ALL VERSIONS*




    More answers regarding syntax to add multiple commands to a single command block

    Answer 2

    An easy format I have come up with to do this without any external program with the falling sand method is to start with this command

    summon FallingSand ~ ~1 ~ {Time:1,Block:redstone_block,Riding:{id:FallingSand,Time:1,Block:command_block,TileEntityData:{Command:____},Riding:{}}}
    

    and insert your first command into "{Command:____}", replacing the ____, and then copy this:

    id:FallingSand,Time:1,Block:redstone_block,Riding:{id:FallingSand,Time:1,Block:command_block,TileEntityData:{Command:____},Riding:{}}
    

    into the brackets at the rightmost "Riding{}" and enter the next command into the next "{Command:____}". Once you have entered in all your commands, you need to delete the last Riding{}, or the command won't run. Keep in mind that the commands will execute in the reverse order than what you input them in.

    If you want to delete the extra block spawned or even the original command block itself as well, then start with this command

    summon FallingSand ~ ~1 ~ {Time:1,Block:redstone_block,Riding:{id:FallingSand,Time:1,Block:command_block,TileEntityData:{Command:/fill ~ ~1 ~ ~ ~-? ~ air},Riding{}}
    

    and replace the question mark at "~ ~-? ~" with 2 * the amount of commands you used and add to that 2 if you want to leave the original command block or 3 if you only want to run it once and then delete it.

    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Ivan Babydov, Ivan Babydov, Anete Lusina, Blue Bird