Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? Get Drive Letter From Label

Feb
240
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.
 
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
...
 

Similar threads

Back
Top