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,594 of 68,980   
   Kerr-Mudd,John to All   
   Re: Timer For Loop in Batch File   
   03 Jul 20 17:04:32   
   
   From: notsaying@invalid.org   
      
   On Fri, 03 Jul 2020 16:39:56 GMT, "Auric__"    
   wrote:   
      
   > Peter wrote:   
   >   
   >> Thanks for the reply but actually I do need the loop.  I should have   
   >> explained this better in my original message.   
   >>   
   >> If the unlocking process happens in less than 7 seconds (which it   
   >> usually does) I want to exit the loop as soon as it's unlocked.  I   
   >> want to use the 7 second timer as a fail-safe only when the unlocking   
   >> process fails and the loop goes on forever.   
   >   
   > Use timeout inside your loop (untested air code; I'm out of practice   
   > so test first):   
   >   
   >   Unlock n:    
   >   set counter=0   
   >  :wait-n   
   >   if %counter%==7 goto nextstep   
   >   timeout 1 > nul   
   >   set /P counter=%counter%+1   
   >   if not exist n: goto wait-n   
   >  :nextstep   
   >   
   > This gives a granularity of 1 second.   
   >   
   > If you're using an old system that doesn't have the timeout command,   
   > use ping instead:   
   >   
   >   ping 127.0.0.1 -n 1 > nul   
   >   
      
   choice /C:X /N /T:X,1>nul   
      
   will also do it   
      
      
   --   
   Bah, and indeed, Humbug.   
      
   --- 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