windows bat exit code fix

Put assignment of exit code outside of localisation block.  Also include
verification of exit code in windows bat tests.