When you want to eject a connected USB drive from a computer, you’ll have to close all the programs that are ran from USB flash drive, or else you’ll get the error message saying “The device ‘Generic volume’ cannot be stopped right now. Try stopping the device again later.” Sometimes even after closing every possible application that is ran from the USB flash drive, you still can’t successfully stop the device. If this happens on my own computer, I have no problems with this issue because I could use Unlocker to unlock processes in use to successfully remove the drive.

This would be a problem when this happens to my flash drive that are connected to other computer which doesn’t have Unlocker installed. If I simply unplug my USB flash drive without safely removing it first, there is a risk of data corruption on my flash drive. I recently found a small tool from Jkwebtalks called EjectUSB which seems to be pretty interesting. From the name of that tool, it seemed like a normal utility to eject a plugged in USB drive but it actually does more than that.
EjectUSB is designed to be a simple utility to close all programs running from a specified drive or folder and then attempt ejection if a drive was specified. Extended functionality includes flushing the file cache, closing Explorer windows and removing registry entries and Recent Document shortcuts referencing the specified drive or folder.
There is no interface for EjectUSB. All you need to do is extract the zip file to your USB flash drive, and then run EjectUSB.exe whenever you want to eject your USB flash drive.

You might be thinking what is the difference between ejecting the USB drive using this tool and the built-in Safely Remove Hardware in Windows? The good thing about EjectUSB is it automatically closes all running programs running from the USB drive. This way it’s very unlikely you’ll get the error that your device cannot be stopped now.
There’s also a settings.bat file where you can access the configuration of EjectUSB. As you can see, it is also able to perform cleanup functions, remove related Subst entries and many more which the Safely Remove Hardware is NOT capable of doing.

Other than using this tool to eject a plugged in device, you can also use it to close running programs that are ran from the partition where EjectUSB is. Let’s say you run a game that is installed in D: drive. If you have EjectUSB in D: drive as well, double clicking it will close the game. However this won’t affect the programs that are ran from other partitions such as your C: drive. EjectUSB can definitely work like a boss-key function to quickly shut off programs that can get you fired ;)
Your antivirus might warn you that EjectUSB is a trojan but it’s not. That is the side-effect of EjectUSB being an AutoIt3 script. You do not need to worry if you’ve downloaded it from the official EjectUSB website.
[ Download EjectUSB ]
dude ! im juz asking how to solve auto connect and disconnect USB Drive ..
youtube.com/watch?v=5_1kHE0VOkk
Thanks Ray, this is a great tool.
I agree with Akshay Chandrashekaran, I’ve tried, the open files from thumbdrive have to be manually closed first before EjectUSB can fully disconnect thumbdrive from computer.
why didnt you post today,pliz post,we all vote for you,pliz post.Post now :))
Hi Raymond
I tried out the software.
Kaspersky did not detect any malicious files in it. However, It does not work up to what you have written. I tested the software with windows media player running a movie and adobe acrobat showing a PDF file from the pen Drive.
The icon of an arrow appears on the taskbar, but both were not closed. I had to manually stop them before ejectUSB could stop the explorer window and safely remove the pendrive.
Cheers,
Akshay
Good tool.
Now is there a tool to re-connect to USB drive after doing safely-remove, while the drive is not actually remove from the computer?
this software not working on my OS. i use windows XP SP3. i clicked the exe file, but nothing happened
Great one.. Thank You.. :)
As always, a very helpful post. Thank You, Raymond.
Hmm, hey Raymond does this tool stay on the usb stick or on the computer?!?! I didn’t really read the article to throughly (is that how you spell it?!?). Also if it’s in an installable file couldn’t i just install it to the usb and execute it from the usb device? Thanks GM_MiCrO
Nice Share! Thanku !
very usefull. thanks
very nice of you master raymond, thanks for this nice tool :)
Thank you very much for this, Raymond. I wonder how come I didn’t find EjectUSB before.
This is very useful!
I used this script for a bit, found it useful, until it stopped working under Vista. Apparently, ESET liked to block it.
If you’re using ESET’s security, you might want to have it allow the script, by either added it to the whitelist, or reinstalling it with the final option to allow potentiality unwanted programs.
Yes it will lower your security a little but a little common sense should pick up the toolbars it would otherwise be pointing out.
Thanks Raymond – hopefully this will sort out my problem with ejecting my Cruzer Micro.
Thanks raymond, tis a good one. I also find “Unlocker” did a decent job too.
Sai Charan, I could start to get the ball rolling instead of waiting for other people to do it first.
sheldon, read the last paragraph?
Shail Shah, I am no programmer but most of the time an AutoIT script is flagged as malicious.
thx!!!
I wanted this for years!!
Really good tool thx alot…
nice.. will give a try ;)
thx raymond ..
that greart! thank it so good ^^
Hi Ray!
This Utility is not working on Windows Vista Home Premium x64!
This show me as a torjan..
pocketappreview.com/main/media//software_zip/EjectUSB.zip
Gateway Anti-Virus Alert
This request is blocked by the SonicWALL Gateway Anti-Virus Service. Name: Small.NCO_2 (Trojan)
Are all/most AutoIt3 scripts flagged as malicious pieces of software?
hey… nice piece of information.. i always thought my usb stick gonna crash someday while displaying those msg.. i will use this utility now..
thnx for the info…
Great! You’ve linked back to JK, who never link back to your blog.
Thank.. i diz software for a year
A useful tool. Thx raymond