|OK, here's one that's driving me crazy....|
If I have a Windows batch script where I need to do two things:
1. Invoke a command and capture the output into a variable.
2. KNOW what the ERRORLEVEL is after that command is invoked.
how do I do this with the FOR /F command?
For example, If I have this FOR command:
for /F "usebackq delims=€" %%G in (`"%JAVA_CMD%"`) do (
(..and assume JAVA_CMD is a valid java commandline that returns a non-zero exit code)
the echo %ERRORLEVEL% ALWAYS echos a value of 0, regardless of the actual value exited by the java program. I am not having issues capturing stdout of the java program, it's the ERRORLEVEL that is vaporizing.
Any help on this one would be greatly appreciated.