Hello Eric, thanks for looking at it and sorry, I was not aware that there was already a patch submitted for this issue.
Could you please give some more details about this EOF handling? When WCMD_fgets returns NULL for EOF the loop is left by the break in line [2309](https://gitlab.winehq.org/wine/wine/-/blob/master/programs/cmd/wcmdmain.c#L2...
About the consecutive lines, those testbot runs [117281](https://testbot.winehq.org/JobDetails.pl?Key=117281) [117271](https://testbot.winehq.org/JobDetails.pl?Key=117271) have them, so I currently do not see an issue there, with both of our attempts to solve it?