home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch      Fun with MS-DOS batch files      42,547 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 40,617 of 42,547   
   eitan.orgil@gmail.com to All   
   Re: Check if drive is present before run   
   03 Apr 13 02:11:58   
   
   95fac275   
   Hi all,   
   I tried to use this on my XP and it is not working for me:   
      
   @echo off   
   FOR %%I in (D E F G H I J K L M N O P Q R S T U V W X Y Z)DO If exist   
   %%I:\updates.disk SET "LW=%%I" ELSE goto :nodrive   
   @echo ***************************   
   @echo * External drive is: %LW% *   
   @echo ***************************   
   pause   
   goto :end   
   :nodrive   
   @echo **************************   
   @echo * no external disk found *   
   @echo **************************   
   pause   
   goto :end   
   :end   
      
   if the file "updates.disk" is on my external drive, it works as expected, but   
   if the file "updates.disk" is not there, I get:   
      
   ***************************   
   * External drive is:  *   
   ***************************   
   Press any key to continue . . .   
      
   and the batch ends   
   The ELSE is not working...   
   any suggestions?   
   Thanks   
      
   Eitan   
      
   --- 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