Well I did something similar : the caché script creates a "success.txt" file when ok and an "error.txt" file when nok.
So the CMD scripts checks the presence of each file to decide what to do next