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,975 of 42,547    |
|    Todd to Todd    |
|    Re: How do I find drive letter for a dri    |
|    06 Aug 14 21:24:42    |
   
   From: Todd@invalid.invalid   
      
   On 08/06/2014 04:17 PM, Todd wrote:   
   > On 08/06/2014 04:29 AM, foxidrive wrote:   
   >> @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   
   >> )   
   >   
   >   
   >   
   > Awesome! Thank you all!   
   >   
   > -T   
   >   
   > This is what I eventually came up with:   
   >   
   >   
   > @echo off   
   >   
   > set DriveLabel=GRTMPOEM_EN   
   >   
   > for %%a in (a b c 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:\nul (vol %%a: |find /i "%DriveLabel%" >nul && set   
   > driveletter=%%a && goto :LoopExit)   
   > )   
   >   
   > :LoopExit   
   >   
   > echo.   
   > echo DriveLabel %DriveLabel% DriveLetter %DriveLetter%   
   >   
   >   
      
      
   Found that I had to break the line up, or I got   
   a space in the variable ("E "). It is easier to read that   
   way anyway.   
      
      
   for %%a in (a b c 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:\nul (vol %%a: |find /i "%DriveLabel%" >nul   
    set DriveLetter=%%a   
    goto :LoopExit)   
   )   
      
   --   
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
   the riddle wrapped in an enigma wrapped   
   in a couple slices of baloney   
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
      
   --- 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