There is a small bug in Windows that I would like to create a small application as a solution for. So, in my company we have several network drives ( F:\, G:\, H:\, I:\ etc.) and sometimes if I connect an external USB device such as a card reader, windows will assign an already used drive letter. So for example, I have a network drive F:\, and I connect my card reader which windows will also assign F:\ to this device, so I cant use that USB device, until I change it's drive letter.

So my question's are:

  • How can I detect these devices or drive letters when they are assigned twice?
  • How can I detect which one of them is a USB device?
  • How can I reassign a drive letter to that device?

I want to do this in C.


  • Admin issue -- redirecting.
    – pst
    Aug 24, 2011 at 6:04
  • 1
    @pst What do you mean with admin issue? I just want to know how to get those drive letters which are assigned twice.
    – kampi
    Aug 24, 2011 at 6:18
  • What pst probably meant is that you can manually change the drive letter assignment. Surely it's quicker to reassign letters yourself than having to write up a program for such an extremely specific situation that you need to test.
    – In silico
    Aug 24, 2011 at 6:32
  • @In silico - i know that, but the reason i want to create an application for this is, that a user cannot change it manually becasue they are not administrators, and that's why i want to make an application, so they can change it too.
    – kampi
    Aug 24, 2011 at 6:36
  • 1
    @Breakthrough: yes, this is what i need, the proper Windows APIs. Necrolis already posted some APIs from Volume Managament right now i'm trying to use them :) I also don't know why this question was migrated, and who or why migrated this question. Thanks for your help!
    – kampi
    Aug 26, 2011 at 5:09

1 Answer 1


most of what you want can be done with FindFirstVolume and its friends (the example here covers everything), to get the type, you would use GetDriveType, then finally SetVolumeMountPoint will rename a device drive letter.

  • SetVolumeLabel will just change the label of the drive not the assigned drive letter.
    – RedX
    Aug 24, 2011 at 7:02
  • @RedX: correct, fixed
    – Necrolis
    Aug 24, 2011 at 7:27
  • Well, this is awkward. Question came from StackOverflow, was properly answered by recommending the appropriate API functions and was then later migrated to SuperUser for no good reason. Even states the user wants to do it in C. Mar 8, 2018 at 16:49
  • @0xC0000022L: your are right. I didn't either understand why it was migrated....
    – kampi
    Mar 9, 2018 at 9:41
  • @0xC0000022L: Hmmm, this is indeed awkward :| well so long as it stays helpful as an answer.
    – Necrolis
    Mar 9, 2018 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.