I created a new Hudson project with a single build step of type "Execute Windows batch command".
Here is how the relevant part of its config.xml looks like (I added the '<<<LF>>>' and '.....' parts):
<builders>"Execute Windows batch command"<<<LF>>>
The config was edited from the Hudson Web UI, using FF 3.6.14 on Win7 x86-64, and config.xml was saved by Hudson with UNIX style EOL, as I tried to represent above using '<<<LF>>>'.
When the .bat for the above build step is generated it looks like this:
Note that the generated .bat file would be correct if the step would consist in just a single line. I think this is actually the core of the problem. The developer who wrote the code that generates the .bat file assumed that the step would only ever consist in one line so he added the '<<<CR>>><<<LF>>>' and 'exit %ERRORLEVEL%' to what is stored in the step's node from config.xml.
However, the assumption is not enforced by the Hudson UI which allows multiline editing for this type of step.
I think it would be good for people running Hudson on Windows to be allowed to write batch scripts consisting in multiple lines on these type of steps. The way to do it would involve modifying the code generating the .bat file to replace all '<<<LF>>>' occurences with '<<<CR>>><<<LF>>>', IF they are not already preceeded by a '<<<CR>>>'.
I also tried to stop Hudson, convert the config.xml EOL to Windows and then restart Hudson. Unfortunately, the generated .bat is still the same. This probably has something to do with the Java classes used to represent the .xml file. Also, if any change is made on the job configuration from the Hudson Web UI, when the config is saved, it is again saved with UNIX style EOL.
If you are running Tomcat on Windows, and you edit your jobs configs via the Hudson Web UI, what is the type of EOL that your config.xml files have?