Batch mode auto white balance

Create the file batch-levels-stretch.scm in ~/.gimp-2.8/scripts, with the following content:

; Usage:
; gimp -i -b '(batch-levels-stretch "*.JPG")' -b '(gimp-quit 0)'

(define (batch-levels-stretch pattern)
     (let* ((filelist (cadr (file-glob pattern 1))))
          (while (not (null? filelist))
              (let* ((filename (car filelist))
                (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
                (drawable (car (gimp-image-get-active-layer image))))
                (gimp-levels-stretch drawable)
                (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
                (gimp-image-delete image))
                (set! filelist (cdr filelist)))))

Then create a folder with a copy of your pictures, and run the following command in it:

gimp -i -b '(batch-levels-stretch "*.JPG")' -b '(gimp-quit 0)'

Make sure *.JPG matches your pictures (case sensitive).

And it will overwrite the pictures, one by one, with the processed image.