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,972 of 42,547   
   foxidrive to Todd   
   Re: How do I find drive letter for a dri   
   06 Aug 14 21:29:01   
   
   From: foxidrive@server.invalid   
      
   On 6/08/2014 14:44, Todd wrote:   
   >> Is there a way from the command line to figure out   
   >> what a drive letter is for a flash drive based   
   >> on the drive's label.   
   >>   
      
   Similar to another reply you have - the if exist command should eliminate the   
   messages from drive   
   letters that don't exist.   
      
   @echo off   
   set "driveletter="   
   for %%a 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 %%a:\ vol %%a: |find /i "MyBackup" >nul && set driveletter=%%a   
   )   
   if not defined driveletter echo drive was not found & pause   
      
   --- 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