Enumerate external drives

前端 未结 2 821
萌比男神i
萌比男神i 2020-12-19 06:25

In java, you can use File.listRoots() to get all drives in the system.

I\'m looking to get only the external drives, i.e. USB drives, external hard disk

2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-19 06:51

    You could use WMI or look into

    GetRawInputDeviceList()

    GetRawInputDeviceInfo()

    This should get you started

    C++

    http://cboard.cprogramming.com/windows-programming/114294-getting-list-usb-devices-listed-system.html

    Java

    http:// forums.java.net/jive/thread.jspa?threadID=37942

提交回复
热议问题