Drive Letters by Volume Label
The Volume Name (also called Drive Name) is the text shown in the drive's properties dialog (right click the drive, "Properties"). The label shown in the Windows Explorer can be the volume label but it also can be a setting from the Windows Registry. If you change the label by single clicking the drive or by pressing F2, it depends on where the current label comes from, which one is changed.
To see and change the real volume label, right-click the drive in the Windows Explorer and select Properties.
To be really sure that the real volume label is changed, use the LABEL command on the Windows command prompt.
Sample:
[DriveLetters]
VolumeLabel=Monday
VolumeLabel=Wednesday
VolumeLabel=Friday
Letter=U
[DriveLetters]
VolumeLabel=Tuesday
VolumeLabel=Thursday
VolumeLabel=Saturday
Letter=X
Drives named Monday, Wednesday or Friday get U and drives named Tuesday, Thursday or Saturday get X.
You can use Wildcards:
[DriveLetters]
VolumeLabel=Backup?
Letter=U
This would fit for a VolumeLabels Backup1, Backup2 etc.
With a minus char you can test of an empty volume label:
[DriveLetters]
VolumeLabel=-
Letter=U
Using as drive letter
Since V4.6 USBDLM can use the volume label directly for the drive letter. For this purpose there is the new USBDLM variable %LetterFromLabel%.
For LetterFromLabel a letter is extracted from the drive's volume label by looking for:
- the last letter which is followed by a colon and preceded by a non-letter, e.g. "Drive X:" or "X: Drive"
- the last letter which is surrounded by non-letters, e.g. "Drive X", "Drive_X", "Drive_X_", "Drive (X)", "X Drive"
Non-letters are the begin, the end, the space and the characters !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~«».
If nothing fitting is found then the variable is empty.
Remark: The colon is a valid character in volume labels of NTFS formatted drives only.
Sample for always trying to extract a letter from the label and fall back to Z: if there is none:
[DriveLetters]
Letter1=%LetterFromLabel%
Letter2=Z
To avoid unintentional interpretation as a drive letter, a VolumeLabel criteria with Wildcards can be configured, to narrow down the usage of a section to exactly the desired naming scheme.
Sample: Use the section only if the label ends on underline plus one character (e.g. Drive_X):
[DriveLetters]
VolumeLabel=*_?
Letter1=%LetterFromLabel%
Letter2=Z
Here some wildcards samples for the VolumeLabel criteria:
- *_? begins with any (or none) character, ends on underline, followed by exactly one character; Sample: "Drive_X"
- * ? begins with any (or none) character, ends on space, followed by exactly one character; Sample: "Drive X"
- * ?: begins with any (or none) character, ends on space plus one character plus colon; Sample: "Drive X:"
- ?: * begins with exactly one character plus colon plus space, followed by any (or none) character; Sample: "X: Drive"
- *(?) begins with any (or none) character, ends on one character enclosed by parenthesis; Sample: "Drive (X)"
Of course you can use more specific labels, like "USB_W", "USB_X", "USB_Y" and the criteria "VolumeLabel=USB_?", to avoid unexpected results with foreign drives:
[DriveLetters]
VolumeLabel=USB_?
Letter1=%LetterFromLabel%
Letter2=Z
Using the volume label may cause slower arrivals or will not work at all because the file system must be mounted to read it. Some drives need a while for getting ready.
The maximum waiting time is 10 Seconds and can be configured in Milliseconds globally in section Settings:
[Settings]
VolumeInformationMaxWait=10000