How to? Get Drive Letter From Label

Feb 23, 2012
238
3
#1
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
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
...