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,345 of 68,980    |
|    Petr Laznovsky to JJ    |
|    Re: GOTO and non existant label    |
|    05 Dec 18 14:12:59    |
      From: nobody@nowhere.com              Dne 5.12.2018 v 10:01 JJ napsal(a):       > On Tue, 4 Dec 2018 23:25:47 -0000 (UTC), Batchman wrote:       >> You need to test that the `value' being returned in the num variable is       >> acceptable to your program.       >>       >> set ok=       >> for %%n in (1 2 3 4 5) do if (%%n)==(%num%) set ok=!       >> if not (%ok%)==() goto task%num%       >> REM drops down for incorrect input       >> echo Invalid input, dummy!       >>       >> NOTE haven't tested this, leaving that for you to complete.       >       > Well, that's the same as refactoring which I'm trying to avoid. The question       > is how to prevent the abrupt batch termination, if it's even possible. It's       > not how to prevent the GOTO command to be called with non existing label.       >              I do not know what did you mean by "refactoring", but isnt it help to add              :missing_label_name       GOTO:EOF              to the end of batch?              --- 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