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,592 of 68,980   
   Peter to All   
   Timer For Loop in Batch File   
   03 Jul 20 07:33:13   
   
   From: pmokover@gmail.com   
      
   I need some help with a timer that would go inside a loop in a batch file that   
   will exit the loop after 7 seconds.  I’m not familiar with the proper   
   commands or syntax to do this.   
      
   This would be in a section of a batch file that unlocks a locked external USB   
   drive (n:).  It typically takes 1-3 seconds for the unlocking to happen.    
   Currently (see below) there’s a loop that just waits for the drive to be   
   readable and then continues.   
     However, on rare occasions the unlock process fails and this loop continues   
   forever.  I want to add a 7 second time limit on how long it waits for   
   unlocking before it gives up and moves on to the rest of the batch file.   
      
   ================   
   Unlock n:    
   :wait-n   
   {{The timer would go here.  If timer = 7 seconds goto ExitLoop}}   
   if not exist n: goto wait-n   
   ================   
      
   Thanks in advance for any help!   
      
   --- 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