A python script that recursively processes png and jpeg images present in the passed in directory and losslessly compresses them using deflopt, optipng, pngcrush, pngoptimizer and jpegtran. This script assumes that you have these binaries in your windows path. Grab the script from github.
python mash.py C:\foo
PS:If this interests you, take a look at the command line client that I wrote for yahoo!’s smush.it service.