home bbs files messages ]

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,347 of 68,980   
   Batchman to All   
   Re: GOTO and non existant label   
   04 Dec 18 23:25:47   
   
   From: batchman@dosville.foo   
      
   On Wed, 05 Dec 2018 04:16:24 +0700, JJ wrote:   
      
   > How to prevent the batch file from abruptly terminated if `goto` is   
   > executed with a non existing label?   
   >   
   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.   
      
   --- 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