I want to open a file in a volume whose name I know, but whose drive letter I don't know.
How can I associate a volume name with its drive letter (in windows)?
Thanks.
windows volume name
Moderator: General Moderators
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
-
dmorley123
- Forum Newbie
- Posts: 2
- Joined: Tue May 30, 2006 1:31 pm
volume name
I have a USB stick with volume label MyUSB. I don't know in advance the drive letter which will assigned to the stick when I plug it in. But I do know the label name (MyUSB). To open a file on that stick I need the drive letter. e.g. fopen("F:myfile.txt,"r"). How can I open the file knowing only the label of the drive?
I've devised a hack which loops through all the drive letters and calls exec("vol <drive letter>:", $volInfo) and looking for the label in $volInfo. There's gotta be a better way. (For one thing, I get 26 Dos windows popping up, one for each drive letter!).
Thanks.
I've devised a hack which loops through all the drive letters and calls exec("vol <drive letter>:", $volInfo) and looking for the label in $volInfo. There's gotta be a better way. (For one thing, I get 26 Dos windows popping up, one for each drive letter!).
Thanks.