Commands blocks can be spawned in with the /setblock command. The basic format used is the following:

/setblock ~ ~1 ~ minecraft:command_block 0 replace {Command:"COMMAND GOES HERE",TrackOutput:0}

With the COMMAND GOES HERE being replaced with whatever command you want in the command block.

Exceptions/add-ons: Edit

There are a few commands that you cannot simply put in between the quotes without changing them a bit in order for the command to work. **Any command that has quotes in it requires a \ before each quote in the command.** This is so that the setblock command does not read the quotation mark as the quote that is supposed to signal the end of the command. Thus the only 2 quotes without a \ before them are the ones that surround the whole command. The new command block that is created from the original command will not have the slashes in the command. They are only for the command to actually setblock them.A complex example of this is as follows:

/setblock ~8 ~-4 ~-24 command_block 0 replace {Command:"/execute @e[type=ArmorStand,name=SetupBoss] ~27 ~10 ~-66 /tellraw @p [\"\",{\"text\":\"Visit zakriboss on Youtube for an awesome technical channel and new command creations!\",\"color\":\"gold\",\"bold\":\"true\",\"underlined\":\"true\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Left click to go to my channel page\",color:blue}]}}}]",TrackOutput:0}

*Note that the slash you are using \ is different than the forward slash (/) that you use to start a command. It is instead located normally on the far right of the keyboard, somewhere below the backspace or delete key.

*Another note. setblock is a verb now, by decree of zakriboss, founder and admin of the technical minecraft wiki.

More examples Edit

Some examples of commands that use quotation marks in the commands:

  • s
  • tellraw
  • title
  • There are many others, but these are just so you can get the idea.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.