Page 1 of 1
windows volume name
Posted: Tue May 30, 2006 1:38 pm
by dmorley123
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.
Posted: Tue May 30, 2006 1:39 pm
by tecktalkcm0391
Where do you want to get the file from?
volume name
Posted: Tue May 30, 2006 2:54 pm
by dmorley123
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.