Javadoc
Wrap command in a CMD.EXE call so we can return the exit code (ERRORLEVEL).
This method takes care of escaping special characters in the command, which
is needed since the command is now passed as a string to the CMD.EXE shell.
This is done as follows:
Wrap arguments in double quotes if they contain any of:
space *?,;^&<>|" or % followed by a letter.
When testing from command prompt, these characters also need to be
prepended with a ^ character: ^&<>| -- however, invoking cmd.exe from
Hudson does not seem to require this extra escaping so it is not added by
this method.
A " is prepended with another " character. Note: Windows has issues
escaping some combinations of quotes and spaces. Quotes should be avoided.
A % followed by a letter has that letter wrapped in double quotes,
to avoid possible variable expansion. ie, %foo% becomes "%"f"oo%".
The second % does not need special handling because it is not followed
by a letter.
Example: "-Dfoo=*abc?def;ghi^jkl&mnostu|vwx""yz%"e"nd"