https://bugs.winehq.org/show_bug.cgi?id=57025
Eric Pouech eric.pouech@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |eric.pouech@gmail.com
--- Comment #1 from Eric Pouech eric.pouech@gmail.com --- Wine's cmd.exe has been fixed to mimic closer Windows' cmd behavior. Did you test these sequences under Windows? What you describe is Windows behavior.
To make a long story short, when you do something "test.bat & echo %errorlevel%", errorlevel is expanded to its value when the whole line is parsed, ie. before executing test.bat.
What to likely want is !errorlevel!. This requires either running cmd with /v:on option or explictely turning on delayed expansion with 'setlocal EnableDelayedExpansion' command.