Hi,

I need some information regarding the APIs to use, to get the drive letter, if I know the label of that drive.

For eg, my hard disk has been partitioned into 3 drives, C:, D:, E:. The labels (label1, label2, label3 )for these drives have been assigned dynamically. I want to locate a file ABC.txt which would be in the drive, of which voulme label is "Label2".

can anyone suggest the API to use, or can this be achieved thru batch script, if so, pl provide the required batch commands.

Thanks,
sv

Use the GetVolumeInformation Function. The Label can be obtained by the LPTSTR lpVolumeNameBuffer parameter.

Thank you for ur reply. But, I don't need the label. I want to extract the drive letter, to which the particular label is assigned. I guess, GetVolumeInformation can do this, if we do for all the drives, but is there any btr solution?

Probably this would give u what u want. Try use that function and see what u get on each return value.

LPCTSTR lpRootPathName,


ssharish

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.