Is there a way to eject/safely remove multiple drives (ie flash drives) at once on Windows? That is, without having to click on each one and then clicking "eject"? Could this be done with a batch file?

  • Seems like Apple has a solution, but on casual look, a MS solution did not jump out at me. – James Jenkins May 3 '13 at 13:20
  • Dang. That sucks. Do you know if there is a way to write a batch file to do it? – yiwei May 3 '13 at 13:27

it is possible that you don't need to click Safely Remove Hardware icon again and again.

One thing you can do is setup your device not to cache data in the computer, so that whenever the transfer is complete, it should be perfectly complete not required to write it down first while ejecting the drive.

To set this up:

  • Open Device manager
  • Click on the USB Drive device
  • Right click on it
  • Select Properties

In the Policy tab,

  • Select the Quickly Remove option (This will make your transfer slightly slower but it will be safe to remove your drive)
  • Make sure the copy/move task has completed

See full process here: How to Remove USB drive quickly without any Risk


RemoveDrive can be used from a batch file:


You can use drive letters or "friendly names". If you want to make the batch file truly generic you can copy the exe (it's really small) to all your removable drives. Then you can simply loop through all drive letters and if RemoveDrive.exe exists execute it using removedrive \ (which will eject the drive the exe is on). Better still, you can loop through and eject only mounted devices using the batch file I posted here.


You could use usb-disk-ejector. The usb-disk-ejector is open source and does this also.


More Command Line options

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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