Win exit code fix

Moved the setting of the exit code in the windows bat template outside of the localised scope.  This ensures that if the call to the java application returns an exit code greater than 0 that the script returns 1 instead of 0.

Also updated regression tests for windows bat testing to check the return code.

The changes were applied to the 0.8.0 branch.

Developed and tested on Windows 7 SP1.