fix issues with JAVA_OPTS/ES_JAVA_OPTS in service.bat

fix handling of non-empty JAVA_OPTS
remove usage of if/else that can be tripped by parenthesis in the variable
fixes #4127
closes #4086