general:
http://en.wikibooks.org/wiki/Windows_Batch_Scripting
http://www.dostips.com/DtCodeCmdLib.php#Function.parse
Math in batch files
http://www.robvanderwoude.com/battech_math.php