Killing all entities except players and armor stands [duplicate]

Is there a way to kill every entity except players and armor stands? I've tried with

/kill @e[type=!Player,!ArmorStand]

and

/kill @e[type=!Player;!ArmorStand]

But it doesn't work. How can I do that?


Run these commands first:

/scoreboard objectives add blackList dummy

Run these on a clock:

/scoreboard players set @e blackList 1
/scoreboard players set @e[type=Player] blackList 0
/scoreboard players set @e[type=ArmorStand] blackList 0

Lastly kill all entities that don't have a blackList score of 0:

/kill @e[score_blackList_min=1]

(edited 5/26/19 for Minecraft 1.14.1)