Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:… and also check this out: – MaQleod Mar 30 '11 at 18:42

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


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.