2

I'm currently playing with VirtualBox and one of the things that annoy me with it is that you have to do such a workaround to get it to boot from USB. So I'm thinking of automating this with a batch file. But one of the problems that I run into is that the command needs the index number of the physical device that is your USB drive, not the drive letter. The original instructions I found ask you to open the disk management app, look-up the drive number and add it to the command by hand. But I'm trying to make a batch file that will show the user the drive index number and the physical device's model tag in a list a bit like this

Drive Name
0     Hitachi HDS721050CLA660
1     Sony Storage Media USB Device
2     SanDisk SanDisk Ultra USB Device

I was originally thinking of using the fdisk -l function like in Linux but that won't work. So, I ended up using WMIC to get some information

wmic diskdrive list /format:list

but that only gives me a long list, not the only information I want. Anybody got an idea?

2 Answers 2

2

Since the USB drive should be seen as Mediatype Removable Media

wmic diskdrive where "MediaType='Removable Media'" get index,model
1
  • That works very well... it's even cleaner than what I expected. Too bad there is so little good documentation on wmic...
    – Flaver-D
    Commented Jul 22, 2017 at 16:40
2

I just figured it out! And it was simpler than expected

wmic diskdrive get index,model

Enjoy!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .