Automatically Close Running Programs and Eject USB Flash Drive

It is always recommended to use the safely remove hardware feature to eject the connected USB flash drive first before unplugging it so that you won’t risk corrupting the data on the USB flash drive. However there are times when you will get the error message telling you that “This device is currently in use. Close any programs or windows that might be using the device, and then try again”. Closing any opened programs or files that is launched from the USB flash drive would normally solve the problem and allow you to eject the drive but there are times when the files are locked to a windows process such as the explorer.exe and there is no way to safely eject the connected device. Your only option is to either shut down the computer, restarting the explorer.exe, or use an unlocker software such as “The Unlocker”.

This device is currently in use

The problem is there’s a very low possibility that public computers have The Unlocker software installed and you may be restricted from shutting down, or restarting the explorer.exe process. One of the easy solution is to use an excellent program called EjectUSB to solve the problem. EjectUSB is a free and portable program that saves you all the effort in trying to safely eject USB flash drives by automatically close all running programs or files that are ran from the USB flash drive and then eject the drive. All you need to do is copy the program to your USB flash drive and run the program directly from the drive.

You won’t find any graphical user interface for EjectUSB other than the Settings which can be launched by running the settings.bat file. Most of the options in the settings are pretty self explanatory and the default options are good enough unless you have specific process that you want to add to the inclusion or exclusion list.

EjectUSB Settings

If you wonder how does EjectUSB manage to eject the USB flash drive when it is ran from the USB drive, we analyzed and found out that the program actually copies itself to the computer’s temporary folder first and then only ran from there. The program will then close all programs associated with the location and finally ejects the drive.

During testing, we experienced a bug on EjectUSB where it does not terminate the running programs that are launched from the USB flash drive which means the drive will not automatically eject until we manually close the running programs. Fortunately the author of EjectUSB added external utility support where it is able to use third party tool called “The Unlocker” to unlock the process so that the USB flash drive can be ejected. What you need to do is download the portable version of The Unlocker, extract and copy both Unlocker.exe and UnlockerDriver5.sys file to the same folder as EjectUSB. EjectUSB will automatically detect the availability of the unlocker files and use it to unlock or close all programs running from the drive.

EjectUSB with Unlocker

Although EjectUSB seems to be an abandoned project because the official website is no longer accessible and was last updated 2 years ago, we have tested it on Windows 7 and it works perfectly when it is paired with the Unlocker tool.

Download EjectUSB

16 Comments - Write a Comment

  1. mafia87 7 years ago
  2. bill 7 years ago
  3. mohan 7 years ago
  4. dawiecool 7 years ago
  5. webcadre 7 years ago
  6. Junn 7 years ago
  7. HellNoire 7 years ago
  8. Merlin_Magii 7 years ago
  9. Liliput 7 years ago
  10. Jun 7 years ago
  11. Ishaan 7 years ago
  12. lawiz 7 years ago
  13. ngoc an 7 years ago
  14. manoj 7 years ago
  15. BillyDaGreat 7 years ago
  16. Firdaus 7 years ago

Leave a Reply

Your email address will not be published. Required fields are marked *

Note: Your comment is subject to approval. Read our Terms of Use. If you are seeking additional information on this article, please ask in our forum or contact us directly.