https://bugs.winehq.org/show_bug.cgi?id=57025
Bug ID: 57025 Summary: error with %ERRORLEVEL% when running command in sequence Product: Wine Version: 9.12 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: cmd Assignee: wine-bugs@winehq.org Reporter: nemos200408@gmail.com Distribution: ---
When running several commands in sequence (by &) next command not see error code (%ERRORLEVEL%) from previous Problem absent in wine 9.11 and present in 9.12-9.14.
To reproduce
in fresh cmd session (wine64 cmd) run from command line test.bat & echo %ERRORLEVEL%
in test.bat only one command exit /b 1
in wine 9.11 it output 1
in wine 9.12-9.14 it output 0
https://bugs.winehq.org/show_bug.cgi?id=57025
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dark.shadow4@web.de
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.
https://bugs.winehq.org/show_bug.cgi?id=57025
--- Comment #2 from Nemos nemos200408@gmail.com --- Confirm, wine 9.12-14 behave like windows 7.
https://bugs.winehq.org/show_bug.cgi?id=57025
Nemos nemos200408@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID
--- Comment #3 from Nemos nemos200408@gmail.com --- Closing
https://bugs.winehq.org/show_bug.cgi?id=57025
--- Comment #4 from Austin English austinenglish@gmail.com --- Closing.
https://bugs.winehq.org/show_bug.cgi?id=57025
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #5 from Austin English austinenglish@gmail.com --- Actually closing.