Can I map a path to a windows physical drive name in Java?

360 views Asked by At

If I have a java path such as "/users/james/.myapp/" can I figure out the physical drive name (ie. \\.\PHYSICALDRIVE0) using just java apis?

I thought this might be possible because you can reference a physical drive in java:

new RandomAccessFile("\\\\.\\PhysicalDrive0", "r");

1

There are 1 answers

0
Xephi On

If you need a solution to check a drive model number into Windows, you can try to read this through Windows Registry, some useful doc can be found here :read/write to Windows Registry

Current drives can be found in HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices