1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to? Get Drive Letter From Label

Discussion in 'Support' started by Avi Shmidman, Dec 8, 2012.

  1. Avi Shmidman

    Joined:
    Feb 23, 2012
    Messages:
    238
    Likes Received:
    3
    TCC has a function to retrieve the drive label of a given drive letter (@LABEL).

    Is there any function to do the reverse? That is, given a drive label, to retrieve the corresponding drive letter?

    My use case regarding external drives: I have a bunch of external drives and memory sticks, which often receive varying drive letters, depending on the order in which they are plugged in. Yet, they each have distinctive drive labels; hence, it would be much easier to access them via label, rather than via drive letter.
     
  2. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    Unfortunately labels do not need to be unique, even if in your case they are. However, a simple DO loop can do the job for you. A very rough outline:

    do d in %_ready
    switch "%@label[%d]"
    case %1
    set dl=%d
    leave
    endswitch
    enddo
    ...
     
  3. dcantor

    Joined:
    May 29, 2008
    Messages:
    516
    Likes Received:
    3
  4. Frank

    Joined:
    Aug 2, 2011
    Messages:
    258
    Likes Received:
    4
    Yes, I can highly recommend USBDLM, too. I use it on all my PCs.
     

Share This Page