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,596 of 68,980   
   Auric__ to Peter   
   Re: Timer For Loop in Batch File   
   03 Jul 20 16:39:56   
   
   From: not.my.real@email.address   
      
   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   
      
   --   
   Be yourself, everyone else is already taken.   
    -- Oscar Wilde   
      
   --- 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