Hello,
this is the first in a series of 3 problems that are blocking me right now...
I need to get the exit code from the inner command in a for /f "delims=" %%l in ('command') do (loop).
I can't rely on the number of loops, ie. the presence or absence of output on stdout, because an empty output is a valid output, distinct from when invalid arguments trigger an error message on stderr.
I tried testing the errorlevel at the end of the for loop, or at the beginning the first loop, but this does not seem to work.
I also tried doing things like 'command ^|^| echo something', but did not find any workable solution.
Any idea on how to do that?
How to get the exit code from the inner command in a for ... in ('command') ?
Moderator: DosItHelp
Re: How to get the exit code from the inner command in a for ... in ('command') ?
Thanks!
I had tried a very similar solution already, but failed.
The critical factor I had not thought about was the carets added in %%^^errorlevel%%.
I suppose this works by preventing the variable expansion in the for context?
I had tried a very similar solution already, but failed.
The critical factor I had not thought about was the carets added in %%^^errorlevel%%.
I suppose this works by preventing the variable expansion in the for context?