It was in the Batman: Last Rites arc which takes place during Final Crisis. Basically, Darkseid's forces captures Batman in FC #1 (or was it #2?) and then later he is hooked up to a machine and a alien parasite entered his mind so that they can use his experience and knowledge to make an army of Bat-clones. However, Bruce was able to stop them by going through all his worst/significant life experiences and basically overloaded the clones with enough angst to drive them insane.