This tool allows you to flash kernels, recoveries, system.img.ext4 and other partitions while operating your phone. it works with ADB obviously. I've chosen to sent direct commands to adb (adb -d shell) instead of a batch script, I used batch scripts for the checks though. Because all ADB actions are hidden I created a log, which tells you what's is going on. Remember that this tool is not a toy to play around with, only use it when needed!