Windows: removable is always null
pdirksen opened this issue · 9 comments
wmic logicaldisk get caption,description,..,drivetype
DriveType is returned as an integer corresponding to the type of disk drive the logical disk represents:
0 = Unknown
1 = No Root Directory
2 = Removable Disk
3 = Local Disk
4 = Network Drive
5 = Compact Disc
6 = RAM Disk
Hi!
Thank you for contributing. Sorry for the loooooong delay. I didn't receive a notification for this issue.
Could you provide me with a more detailed description of the current behaviour versus the behaviour expected?
Have a wonderful day ✨
Cheers,
Philippe
@jacargentina Well... thats not a valid workaround because the description text is localized. That said, I'm parsing this in the same way right now.
@philippefutureboy As you can see in the json output of #12 removable
is always null
. true
/false
is the expected value here.
@pdirksen so you basically need removable: (disk.DriveType == 2)
?
@jacargentina This and extending the constant COMMAND
to get the drivetype as well.
Unfortunately the wmic columns in the output is always sorted, regardless of the order that has been set.
Before:
Caption Description DeviceID FileSystem FreeSpace Name Size VolumeName
After:
Caption Description DeviceID DriveType FileSystem FreeSpace Name Size VolumeName
After reordering drivetype I got the expected output.
@pdirksen thanks for that; now fixed.
@philippefutureboy adding an "empty CD-ROM" output example for windows, shows the parser is very weak; tests failing on the new input.txt; want to look at it? I think the main cause is there are many spaces (not just 2, and not tabs either) separating some fields on the last line for the empty CD-ROM I've added
Maybe we should get a safer parseable output, CSV would be much safer I think. ie. wmic ..... /format:csv
Yes, definitely, I remember struggling on the spacing – I didn't know that wmic
had a /format flag. The csv idea is definitely a great one!