Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch    |    Fun with MS-DOS batch files    |    42,547 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 41,781 of 42,547    |
|    Herbert Kleebauer to Anton Shepelev    |
|    Re: A failed output redirection does not    |
|    11 Nov 19 17:56:35    |
      From: klee@unibwm.de              On 11.11.2019 17:31, Anton Shepelev wrote:              > The line       >       > type a > C:\NOSUCHNDIR\est.txt       >       > contains two actions: an invocation of `type' and       > the redirection of its output to a file. If `type'              'type' simple writes to stdout and never sees the redirection       part of the command. The redirection is done by CMD when       it parses the line. If the redirection can't be done       because of a non existing directory, then 'type' is       never invoked and therefore can't change the errorlevel.              > resets ERRORLEVEL on success, why does the previous       > value of ERRORLEVEL matter? If a failed redirection              If 'type' isn't executed because of the impossible redirection,       then type can't modify the errorlevel and it therefore has       the same vale as before the 'type' command. So set       the errorlevel to 1 before the 'type' command. If 'type'       is executed and successful, then errorlevel is reset to 0       by 'type'. If 'type' isn't invoked (because of the redirection       error) or is invoked but not successfull (maybe disk full),       then the errorlevel is not 0.              > sets ERRORLEVEL, why does the result of `type' mat-       > ter? Perhaps I misunderstand the sequence in which       > the shell executes that line...       >              --- 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