How can I specify a particular spawned armor stand in a later command?

If you're spawning the armor stands via commands or command blocks, you can simply specify a name attribute for them, and test for that name in your selector with @e[type=Armor_Stand,name=Whatever]. Otherwise, it might be possible to name an armor stand via a name tag at an anvil, but I'm not 100% sure on that.


You use scoreboard tag in your third command:

/scoreboard players tag @e[type=Armor_Stand,c=1] add stone

It is used to target the stand to kill it in the last command.

I recommend summoning the armor stand with a tag and using that tag to target it for all the commands:

/summon armor_stand ~ ~ ~ {Tags:["Build"]}

This will allow you to target just that specific armor stand in all your commands, as well as, eliminate that third command completely. If nothing else has that tag, you can use only that tag in the target selector.

One final unrelated note: the first two commands are execute commands with a testforblock command. The execute command has an optional testforblock style check built in. You can replace the first two command with a single command.

All this together would give you the commands:

/execute @e[tag=Build] ~ ~ ~ detect ~ ~-1 ~ iron_block -1 testforblock ~ ~-2 ~ diamond_block

/execute @e[tag=Build] ~ ~ ~ /setblock ~ ~-2 ~ minecraft:structure_block 0 0 {metadata:"",mirror:"NONE",ignoreEntities:0b,powered:0b,seed:0L,author:"AlexDAM",rotation:"NONE",posX:-4,mode:"LOAD",posY:-1,sizeX:9,posZ:-4,integrity:1.0f,showair:0b,name:"9x9House",id:"minecraft:structure_block",sizeY:6,sizeZ:9,showboundingbox:1b}

/execute @e[tag=Build] ~ ~ ~ /setblock ~ ~-1 ~ redstone_block

/kill @e[tag=Build]

To find out the name of the armor stand, stand in the middle and execute this command:
/execute @e[r=1, type=armor_stand] ~ ~ ~ say @s
In the chat should appear the name of the entity. you can now affect only this armour stand by adding name=[what appeared in the chat].

Example=
/execute @e[r=1, type=armor_stand] ~ ~ ~ say @s
In the chat appears= 123456789
I want to kill this armour stand, so the command I would use is:
/kill @e[type=armor_stand, name=123456789].

I hope you found that clear. If you have any questions, feel free to comment.