It doesn't work with batches because it was never scripted that way. You would have to add the command to either start a new batch or write to an existing batch. My guess is, to be consistent, you'd want it to write a new batch each time, because otherwise how would you know what batch to add it to, programmatically?