The anti-pants battle legs are a weapon used by Zim in Issue 8 of the comic series.
Zim allies with the Space Pants, using them to conquer the Earth but intending to destroy them once they've eliminated the humans for him. Once Dib reveals this to the pants' queen, the Ubertrouser, they team up to defeat Zim, with Dib riding in the Ubertrouser like a pilot.
However, Zim reveals that he had plans for just in case of something like this, and summons the battle legs. They fly to him from his base, and he puts himself in them. He then uses the laser guns equipped in them to fight Dib and the Ubertrouser in a traditional space pants' fight called "Pants Pants Revolution". This fight lasts for 14 hours, before the battle legs overheat, giving Dib the upper hand.
The battle legs then explode, injuring Zim, but when Dib and the Ubertrouser argue over the pants' intent to keep conquering Earth anyway, Zim takes the opportunity to send out the signal to kill all the pants.
The battle legs make a cameo appearance in Issue 25 as one of the images of Zim's past exploits on Fitzoo-Menga's computer.