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

link|improve this question

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

3 Answers

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."
link|improve this answer
1  
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
feedback

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

link|improve this answer
feedback

You can use DevEject.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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