6

How do I unmount a volume (USB flash drive) via command-line or Visual Basic script?

Ƭᴇcʜιᴇ007
  • 111,883
  • 19
  • 201
  • 268
Jotham
  • 478
  • 1
  • 7
  • 13
  • AFAIK, neither DOS nor COMMAND.COM support USB flash drives. Did you mean `cmd.exe`? – u1686_grawity Mar 30 '11 at 18:41
  • 2
    Check this out: http://stackoverflow.com/questions/296560/mount-unmount-usb-drives-with-vbscript and also check this out: http://portableapps.com/node/639 – MaQleod Mar 30 '11 at 18:42

3 Answers3

5

Check out the two following Windows utilities:

  • Mountvol - "Creates, deletes, or lists a volume mount point."
  • Devcon - "Using DevCon, you can enable, disable, restart, update, remove, and query individual devices or groups of devices."
Ƭᴇcʜιᴇ007
  • 111,883
  • 19
  • 201
  • 268
  • 3
    Despite the name, `mountvol` doesn't do the same thing as the other tools (which is to sync and unmount the filesystem); rather it only manages paths through which a mounted filesystem can be accessed. – u1686_grawity Mar 31 '11 at 13:06
2

You can use DevEject.

paradroid
  • 22,761
  • 10
  • 76
  • 114
1

From a batch script, the easiest way is to call USB Disk Ejector. (Sync might work too, but it wants a drive letter, which is not always predictable.)

u1686_grawity
  • 426,297
  • 64
  • 894
  • 966