As I needed the answer to this question, I thought I would expand on it a bit more.
If you want to run a batch file on compile the answer above is perfect.
I did this to run a batch file that auto committed the project folder to SVN. Works for all the software department as I created this inno as a template for all releases.
to expand on the answer above
Batchfiles may take more than one argument
#expr Exec() only has the second argument for your string of command line arguments.
Therefore, if you need to pass the batch file more than one argument, concatenate the arguments as such:
#expr Exec(BatchFilePath, MyOutputDir + " " + MyAppName + " " + MyAppVersion)
so it is still Exec([targetfile],[stringofarguments])
Hope this helps