I have a .bat which emits "
Exit 1" in case of failure, this is closing the cmd window and prevents user to see the details of error.
I would like to force cmd to stay opened to see the messages.
I know that I could have used
EXIT /B 1 in .bat to not close the cmd automatically, but only interrupt the script.
/B When used in a batch script, this option will exit only the script (or subroutine) but not CMD.EXE If executed on the command-line it will close CMD.exe
But the .bat is generated by a tool, so I can't simply modify it. Obviously, for the same reason I can't just add "PAUSE" in it.
I also know about "cmd /k" which avoids to close cmd after to have run a script, but it just keeps the cmd open once a script is successfully executed, if an "EXIT" function is emitted, it does not prevent cmd to close.