In a cmd.exe window, when I run python -c "exit(12)" and then run echo %errorlevel%, it prints 12. After that, when I run python -c "exit(13)" & echo %errorlevel%, it prints 12.
Why does the second command fail to print the correct exit code?
&operator and run them in sequence it will produce the expected value. Python is irrelevant here.