Question: how to get a command block in minecraft demo?
Answer: Create a world that enables cheats. If you start your world in Creative mode, cheats are enabled by default. ... 
Clear out a space in the inventory. ... 
Open the chat menu. ... 
Type/give <your username> command_block. ... 
Press Enter.