You are here

Disconnect USB automatically

7 posts / 0 new
Last post
SHADOW-XIII's picture
Last seen: 12 years 10 months ago
Joined: 2005-12-22 11:19
Disconnect USB automatically

As you all knows after connecting USB hardware, new icon on the tray appears where you can disconnect (safely) your USB hardware, so you will not loose any data.
But there are few problems with it:
- maaaany clicks
- even more clicks if the drive isn't prepared to be disconnected ...

So I would like to ask, if anyone knows a script or something (or maybe there is a special executalbe with some extra parameters) that after running it will try to disconnect device over and over again until it's finished.

It would be also much easier now to turn off that, like I could attach it to my dock and disconnect USB with just 1 click.

John T. Haller
John T. Haller's picture
Last seen: 58 min 35 sec ago
Joined: 2005-11-28 22:21
Not many clicks

Actually, it takes fewer clicks than people think. Just left-click on it and select the drive to disconnect. That's it.

Unless it isn't ready... in which case even programatically, you couldn't "safe" eject it. You have to wait until the writes finish.

Sometimes, the impossible can become possible, if you're awesome!

SHADOW-XIII's picture
Last seen: 12 years 10 months ago
Joined: 2005-12-22 11:19
that did a trick but still I

that did a trick but still I am looking something to put on my dock, then clicking on it would trigger closing dock and unplugging usb (while usb isn't ready it would try every second to do that)

Embrace your dreams

Last seen: 15 years 7 months ago
Joined: 2006-03-30 04:41
Here's a app I use


To automate this, you can use deveject.exe available here (includes
C++ source code as well):


For help, run deveject.exe /? in a command prompt.

Works for Windows 2000/XP/2003.

An example using the EjectName command line switch:
deveject.exe -EjectName:"USB Mass Storage Device"

It works for Ipods & USB

Last seen: 15 years 2 months ago
Joined: 2006-01-18 19:01
Unlocker will free your drive, but not eject it.

I use Unlocker ( work. For some reason my work computer never wants to let go of my USB drive. At home it ejects with no problems (after i've stopped all my apps)

The Unlocker website also lists other programs that have a similar function. Too bad it's not portable.


Last seen: 5 years 4 months ago
Joined: 2006-01-12 21:12
How I use Unlocker

I have a hard time removing my portable hard drive at work too. At home I never had a problem, so I tried Unlocker and finally found what was happening.

I installed Unlocker to a PC and copied the folder to my USB drive. I then uninstalled unlocker from my host PC and use it from my PStart menu. I created the the following .bat file in my unlocker folder and start unlocker from my PStart menu by pointing to this .bat file:

*****copy text below*******************

:: Charles McCrea run unlocker from command line

@echo off
echo @echo off> volume.bat
echo set getdrv_=%%3>> volume.bat
dir | find "Volume"> go.bat

call go
if exist volume.bat del volume.bat
if exist go.bat del go.bat
start "unlock my usb please" unlocker.exe "%getdrv_%:"

*****copy text above*******************

I shut down everything that is running from my portable hard drive expcet for the PStart menu.

Unlocker usually shows that PStart is still running as well as unlocker.exe itself, but what I've noticed is that I always have a System process running to a "change.log" file on my USB drive. Once I unlock this process and shutdown PStart and unlocker, I can left click on the safely remove hardware button and remove my portable drive.

I don't know if unlocker leaves anything on the host PC, but at least I feel more comfortable removing my hard drive safely without having to shut down my PC first.

Last seen: 15 years 5 months ago
Joined: 2006-04-16 12:58
Check This Site:

Edit: I made a mistake...i posted unmount, but i really meant RemoveDrive. I named my Batch file unmount...but the Prog's name is really RemoveDrive! sorry Wink
look for--> RemoveDrive
It has an app i use always instead of the old "safe remove..." and works fine.

I made a batch file:

@echo off
RomeveDrive.exe "Kingston ..." -l


just run it, and then it loops until it succeds.

sometimes i also use a program called ProcessXP to close any process from my USB key. it's not too much work though.

i hope it works for you

Lo importante es no dejar de hacerse preguntas. -- Albert Einstein
(What's important is not finishing making questions)

Lo importante es no dejar de hacerse preguntas. -- Albert Einstein
(What's important is not finishing making questions)

Topic locked