How to? Get Drive Letter From Label

Feb 23, 2012
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.
May 20, 2008
Elkridge, MD, USA
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
Similar threads
Thread starter Title Forum Replies Date
Fross Accessing No-Drive Letter Resources Support 4
fpefpe (the new) google drive Support 15
Jay Sage Documentation Function @DRIVE Missing in Help Lists Support 0
DrusTheAxe Runaway TCC.exception.log filling drive Support 5
Jay Sage Removable Drive Not Detected Properly Support 11
gworley Virtual network drive filename completion doesn’t get directories Support 0
Chen Touboul TCC not recognize maped drive Support 18
C How to make list of drive contents when shutdown PC / Everything.exe Support 7
S 32-bit Take Command v22 install for thumb drive Support 1
vefatica DEL /R on a SUBST'd drive? Support 1
J Remote storage drive implementation Support 2
Fross WebDav Drive Mapping Issue Support 19
Joe Caverly How to? Use SYNC with a network drive Support 4
S How to? Registered Take Command 18 on USB thumb drive Support 1
I Hidden files on USB Drive Support 4
S WAD Cannot access mapped drive in 64b Win7 Support 15
T How to? @files and trapping "no disk in drive errors" Support 4
L Network Drive slowness Support 0
old coot dir /s dies on my C: drive Support 2
A How to? Wake up a sleeping drive Support 14
L How to copy an old xp drive to a large ntfs drive Support 6
E WAD Open handle on USB drive in TCC Support 3
mfarah How can I tell if a drive is a SUBSTitute? Support 4
S Windows Title of Drive & Directory? Support 4
S Create links or junctions on network drive Support 5
S MOVE to different drive Support 3
S Lost Reg After Moving OS to Diff Drive Support 1
S Version 11 ZIP /V - Permission denied on Network drive Support 2
A GPF when copying large amount of data on busy USB Drive Support 3
R Take Command will not release network drive Support 2
R script problem with mapped network drive Support 1
Z Take Command deletes the next letter when I insert a missing letter ? Support 5
fpefpe How to? gosub and label search Support 4
MikeBaas How to check if label exists? Support 3
S PDIR and @LABEL questions Support 4
electrotype Error using TCC: "Label not found" Support 6
R Button label is blank - 11.00.48 Support 0
John Posner Command grouping and GOTO label Support 9

Similar threads