This question already has an answer here:

I want to set a testfor commandblock. This is the command I want in the block: /testforblock 1998 10 657 glass. What is the setblock command to have this in a commandblock?

marked as duplicate by Tim S., arghtype, dly, Virusbomb, Schism Jun 26 at 6:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


This is the command to setblock with a command block that has a command:

/setblock <x> <y> <z> command_block 0 {Command:"/testforblock 1998 10 657 glass"}

You just use the command data tag

Not the answer you're looking for? Browse other questions tagged or ask your own question.