Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch.nt    |    Fun with Windows NT batch files    |    68,980 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 67,680 of 68,980    |
|    JJ to Kenny McCormack    |
|    Re: Invalid (missing) command crashes ba    |
|    18 Nov 20 19:42:18    |
      From: jj4public@gmail.com              On Wed, 18 Nov 2020 02:03:04 -0000 (UTC), Kenny McCormack wrote:       > Something I just discovered, quite by accident.       >       > Normally, in a batch file, if I try to run a non-existent command, it just       > generates an error message and continues:       >       >:: My batch file       > floofklsdf       > echo Well, that didn't work, but we're still running...       >       > But if I do a pipeline, like this:       >       >:: My batch file       > someValidCommand | floofklsdf       > echo Well, that didn't work, and now we're crashed.       >       > The echo does not get executed. The batch blows up (exits) after the       > pipeline fails.       >       > Is this a good thing?              IMO, in terms of programming, yes. Any unhandled runtime error should       trigger a fatal error and terminate the whole program in order to prevent       potential damage or incorrect result due to missing, incomplete, or       incorrect data.              However, this particular problem should normally be handleable using       ErrorLevel, but CMD.EXE treats it as a fatal error instead.              I don't know whether it is intended or it's a bug, but this error treatment       is no longer compatible with MS-DOS COMMAND.COM, and it applies to CMD.EXE       since NT3.x.              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca