EjectUSB

EjectUSB
Version 1.6
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.

Documentation and an example configuration file are included in the ZIP. The source code is available as a separate download.

TrueCrypt and combination flash card / flash drives support will be made available via configuration files after sufficient testing has been conducted.

See EjectUSB in action!
» Watch the flash video

Release Version 1.6:
» Download EjectUSB (259 kilobytes, 115269 downloads)
» Source Code (26 kilobytes, 9186 downloads)


Change Log:
Version 1.6
- Bug fix: EjectUSB no longer triggers file access errors on WinXP when run from read-only media when trying to load its hourglass tray icon.
- Bug fix: Sysinternals registry keys are no longer erroneously deleted.

Version 1.5 (161498 downloads)
- Bug fix: EjectUSB's ejection success message will more reliably appear on Vista.
- Bug fix: EjectUSB's ejection success message will only disappear when the ejected drive is unplugged instead of disappearing when any USB device is unplugged.
- Bug fix: EjectUSB will no longer display an error if WMI functions fail.
- Improvement: EjectUSB's ejection success message now displays the ejected drive's name.
- Addition: Added /ini command line argument to allow a settings file to be specified.
- Addition: Added /settings command line argument to display a settings interface window.
- Addition: Included Settings.bat with the download to make adjusting settings easier.
- Change: Modified the manifest information.

Version 1.4 (88989 downloads)
- Bug fix: Graceful program closing no longer only targets programs with a visible window.
- Bug fix: Flushing file buffers can no longer cause ejection to fail.
- Improvement: Dead tray icon cleanup is more resilient and slightly faster.
- Improvement: EjectUSB can now generate its own ejection success message. This will make ejection seem much faster on most computers.
- Addition: Added NoFakedMsg setting to the configuration file format.

Version 1.3 (107575 downloads)
- Bug fix: Program closing on Win9x works again (was broken in 1.2).
- Bug fix: Fixed issues on Win9x when running EjectUSB from a drive's root folder.
- Improvement: Implemented hybrid batch scripting. This provides theorhetical support for TrueCrypt and combination flash card / flash drives as well as conditional operations.
- Improvement: EjectUSB can now interface with EjectMedia.exe to eject flash cards / CDs.
- Improvement: Implemented support for Subst.
- Addition: Added DoNotSubst and NoRedirect settings to the configuration file format.
- Addition: Added /nobat command line argument to disable use of the hybrid batch file (if present). Meant to be used within the hybrid batch file if starting another instance of EjectUSB to prevent infinite loops.

Version 1.2 (4933 downloads)
- Bug fix: Improved handling of relative paths (\ and ..).
- Improvement: Implemented API-based ejection.
- Improvement: Implemented file cache flushing. Requires admin privileges.
- Improvement: EjectUSB can now interface with Sync (from Sysinternals) to flush the file cache (instead of using its own internal file cache flushing function). Requires admin privileges.
- Improvement: Improved command line argument parsing; drive letter or folder path no longer are required at all and no longer must be the first command line argument.
- Improvement: Efficiency improvements related to DLL calls.
- Addition: Added DoNotFlush and NoEjectAPI settings to the configuration file format.
- Change: RemoveDrive.exe is called with the -L switch to loop until successful ejection. This can be aborted by closing the RemoveDrive.exe console window.
- Change: DevEject.exe is now launched hidden.
- Change: Added current version number to EjectUSB.exe version info.

Version 1.1 (3413 downloads)
- Bug fix: Improved ejection capability via EjectUSB's own internal ejection routine.
- Bug fix: Improved command line argument and input parsing for handle.exe; there were some formatting differences between the output on Win9x and WinXP.
- Bug fix: TimeToWait is now a maximum per ''phase'' rather than per program; in rare cases EjectUSB could wait for multiple minutes on closing programs with the default TimeToWait value of 5 (seconds).
- Bug fix: Cleaning up dead tray icons was triggered by faulty criteria; in simple terms, dead tray icon cleanup was occuring when it didn't need to (wasting up to 1 second).
- Improvement: Minor efficiency improvements related to the previous two changes.
- Improvement: EjectUSB can now interface with Unlocker to close open file handles; simply UniExtract the Unlocker installer and put Unlocker.exe and UnlockerDriver5.sys in the same folder as EjectUSB. Unlocker requires admin privileges and doesn't work on Win9x.
- Improvement: Added a FAQ section to the documentation.
- Change: Slight change to the EjectUSB logo.
- Change: Separated the source code into its own ZIP file. Source code for EjectUSB will always be released with each version of EjectUSB.

Version 1.0 (1695 downloads)
- Initial release.

[ 07 August, 2009 ] • [ William Hedrick ] • [Bookmark and Share]

Comments (141)

[ Page 6 of 8 ] • [ << | < | 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 | > | >> ]

Ok, maybe Exclusions works on "1st pass", I can't see it anyway, but how can I be sure, that wrappers will have time for saving their settings? I think EjectUSB should wait for their own, self-dependent termination.
[ 25 April, 2009 ] • [ Dima ] • [ 10:38:38 ]

Portable wrappers typically get their job done in under a second; a TimeToWait of 30 should easily give even a slow operation (copying some sizable settings file to a flash drive) plenty of time to complete. I highly recommend you set NoGraceful to 0 and be positive you have Exclusions set for your wrappers. If all of your portable wrappers have ''Portable'' in their executable name, then an exclusion for ''Portable'' will keep them from being forcefully closed until after TimeToWait seconds have passed. As for making sure settings save, the only way to be sure is to change a setting, use EjectUSB, and then see if the setting change was saved. In the case of Exclusions, TimeToWait is how many seconds an excluded program has to terminate itself, so for portable wrappers, they'd have 30 seconds to save settings and close on their own (with a TimeToWait of 30). If they get done before TimeToWait has passed, EjectUSB just continues on with its next cleanup steps and then ejects.

I do plan to implement absolute exclusions so that EjectUSB won't close a given program under any circumstances, however there should be nothing preventing the current system from working in the way you're wanting (other than it will close PStart). Absolute exclusions will just cause situations where a given program never closes and so ejection never succeeds (which is the primary purpose of EjectUSB), I don't see myself as ever using them personally. That said, they'll likely be implemented in version 1.6.
[ 25 April, 2009 ] • [ William Hedrick ] • [ 12:19:49 ]

Thanks for reply. But it seems, that TimeToWait is just doesn't work. I've tried even TimeToWait=3000, suspecting that it is in ms, but everything is closed in a second.
And the main problem - I launch notepad from target disc, change current document (so it's gonna ask me on closing, if I want to save my document), launch EjectUSB and... everything was closed without any confirmation, so I lost my document.
People, please, check EjectUSB that way before use it.
As I can see, it's common problem, "The only little problem stay to close firefox (portable) ... He think it's a crash at the next start!..." as said Totoche.
So, as I said, "EjectUSB forces applications to close, so that they can't save their settings".
[ 26 April, 2009 ] • [ Dima ] • [ 22:02:17 ]

perfect tools!
You save me from ejecting MSD devices on Vista.
[ 28 April, 2009 ] • [ James Mai ] • [ 02:53:47 ]

Firstly, congratulations for EjectUSB, I use it on my 4 USB keys.

I don't know if it's possible, when the USB key closes, could you include with the drive's name, the name of the USB key?

I ask that because I make a backup from a USB key to another one and I need to know the name of each USB key when closing.

TIA and have a good evening William!
[ 03 May, 2009 ] • [ Marcel Poirier ] • [ 15:44:48 ]

With version 1.5, double clicking on ejectusb.exe on Vista Sp2 32 bit, nothing happens at all.
Nothing at all...
[ 15 May, 2009 ] • [ charlestek ] • [ 06:43:44 ]

Thanks for all "Addition" :-)
[ 17 May, 2009 ] • [ Totoche2607 ] • [ 05:30:42 ]

A success story here: have you heard about Garmin Nuvi GPS units? They mount as a USB volume, and the screen stays on for the duration that it is attached via USB--really stupid of Garmin. Anyway, a post at http://www.fixya.com/suppor... suggested that ejecting worked to turn the screen off while still chargine. But how to do this easily? Hurray for EjectUSB! A script like:

EjectUSB /eject d

is just what I needed on my XP system.

thanks!

larry

BTW, I had no luck with ejectusb working without an argument by running from a folder on the usb drive itself... perhaps I misunderstood those directions.
[ 22 May, 2009 ] • [ larry ] • [ 21:14:21 ]

I would like to see it run from the try with popup menus, the built in windows eject doesn't even give names or sizes, also, How about a right click context menu? Right click on a drive and select ejectusb... anyway thanks for a great program!
[ 24 May, 2009 ] • [ Long.Knight ] • [ 13:22:30 ]

Can't support playing Video with USB.
[ 26 May, 2009 ] • [ scavin ] • [ 10:47:47 ]

FYI, I couldn't get it to work either. Tried all the suggestions above. I'm on a simple XP system. Using the safely remove hardware works very quickly on my system. Running from c:ejectUSB.exe /eject h: leaves the icon in the tray forever. Too bad. i really wanted this to work.
[ 04 June, 2009 ] • [ Ray Barbieri ] • [ 15:18:59 ]

If you are having trouble here, try this: ftp://ftp.heise.de/pub/ct/l...
[ 04 June, 2009 ] • [ Ray Barbieri ] • [ 15:31:25 ]

Your download has a virus generic worm in it and the .exe has to be deleted. I liked the program but can't use it if 3 different virus checkers find it contaminated!!
[ 12 June, 2009 ] • [ paladin ] • [ 16:41:51 ]

I'm also getting a virus detection (Worm/Generic.ABWH) in AVG Free. =\
[ 12 June, 2009 ] • [ TN ] • [ 17:28:12 ]

I too am having AVG detect a worm in this program. I have uninstalled it from my machine until there is some kind of explanation from the author. Same as user above, Worm/Generic.ABWH

It could be a false positive, or then it could be a real worm. Nobody should install or use this program until this worm or false positive is addressed by the program's author.
[ 12 June, 2009 ] • [ K. Foster ] • [ 19:33:10 ]

My AVG Detect Version 1.5 As "Worm/Generic.ABWH"
[ 13 June, 2009 ] • [ Ravindra Chauhan ] • [ 01:23:45 ]

It's a false positive; the source is available for download above. You can download AutoIt3 and rebuild the executable yourself if you're paranoid. I'll submit a report to AVG (I've had trouble with them and false positives before) when I am able.
[ 13 June, 2009 ] • [ William Hedrick ] • [ 04:39:35 ]

Can't get this to actually do anything. I'm running WindowsXP. The drive is a Western Digital 80GB harddrive.
It does close all open processes though. That's a nice bonus. Probably just use it for that functionality alone.
[ 19 June, 2009 ] • [ CottonEyeJoe ] • [ 07:52:03 ]

I'm having a problem trying to get EjectUSB quit some on-board apps then eject. Specifically the problem I have is with Portable Firefox. I usually have multiple browser windows open with multiple tabs, and when I fire off EjectUSB it looks like it's trying to close each window individually, with the resulting "This window has multiple tabs, are you sure?" dialog popping up for each window. First up, even if this worked, it would stop me being able to do a full session restore on restart, as only the final window to be closed would register as the session closing, and more importantly, it looks like EjectUSB is continually trying to fire off the Close Window for each window, so that I'm never able to actually hit the confirmation button on the warning dialogs.
Any thoughts on a solution or workaround?
[ 26 June, 2009 ] • [ Endareth ] • [ 00:43:48 ]

working great on Vista 32. Successfully ejected a USB HDD that windows and 'USB Safely Remove' could not.

I sure wish I could run this at startup and have it sit in the minimized window waiting for use for a simple click and select drive to remove.
[ 29 June, 2009 ] • [ Jeff ] • [ 12:13:52 ]

[ Page 6 of 8 ] • [ << | < | 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 | > | >> ]

Add Comment