Agreed we need the official word on the action of "exit" - if we are taking advantage of an unintentional feature it may well vanish in new versions.As regards the error number, negative values work fine for @ERROR and you won't accidentally hit a valid system error number (like 1001
). I didn't suggest negative values originally, as I wasn't at all sure how they'd affect ERRORLEVEL for batch file processing. As @SERROR is a macro call, it shouldn't be at all difficult to trap negative values of @ERROR and return a user defined string. Only one error string needs to be kept as there is only one @ERROR in effect at any time.
I propose then:
1) "exit" should have a second optional parameter which sets a user defined error message.
2) If @ERROR < 0 the content of the user defined error message is returned. If @ERROR >=0 it uses a system call to retrieve the string as it does now.
Of course this pre-supposes that "exit" is working as it should now.
------------------
Richard Howarth