Take the 2-minute tour ×

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

share|improve this question
AFAIK, neither DOS nor COMMAND.COM support USB flash drives. Did you mean cmd.exe? –  grawity Mar 30 '11 at 18:41
Check this out: stackoverflow.com/questions/296560/… and also check this out: portableapps.com/node/639 –  MaQleod Mar 30 '11 at 18:42

3 Answers 3

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."
share|improve this answer
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. –  grawity Mar 31 '11 at 13:06

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.)

share|improve this answer

You can use DevEject.

share|improve this answer

Your Answer


