How can I uniquely identify a USB key from C#?

后端 未结 3 1786
夕颜
夕颜 2021-02-10 00:40

I\'d like to be able to detect when a USB key is inserted. Furthermore, if I can distinguish between USB key A and USB key B then I am in even better shape. Lastly, if I can u

3条回答
  •  -上瘾入骨i
    2021-02-10 01:28

    All hard-drives have a Serial Number, USB flash drives are no different. Here is an article, with a sample project, that shows how to get the non-volatile serial number. Basically you just need to enumerate the system drives and grab the PNPDeviceID property.

提交回复
热议问题