Portable Device Path on Windows

前端 未结 3 577
一整个雨季
一整个雨季 2020-12-11 05:36

I\'ve actually got an Windows/Java Question. I\'ve got a plugged-in device which I want to access via Java. Normally you can access an e.g. USB-Stick via the Drive letter..

3条回答
  •  遥遥无期
    2020-12-11 06:13

    Like *nix systems, all devices (including drives) have paths that are part of a common root, this is normally hidden from users because they use the drive letters which are aliases to these fundamental paths, but you can also use full device paths by prefixing the path with "\\.\"

    For instance, on my machine D: translates as "\Device\HarddiskVolume1" and can be accessed by passing "\\.\HarddiskVolume1" to CreateFile.

    So the path to your device is probably "\\.\Archos 5s".

提交回复
热议问题