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

@jim
Sorry for the question? According to the FAQ, I guess you can't :-(
Jim
[ 11 August, 2008 ] • [ Jim ] • [ 08:36:32 ]

What's the license? I'd love to use this in the office, but they won't let me unless you explicitly state that it is ok (it works great at home, though - thanks!
[ 11 August, 2008 ] • [ Anne O-nymous ] • [ 23:42:56 ]

Is there a way to put this in the PortableApps launcher?
[ 12 August, 2008 ] • [ dov717 ] • [ 20:04:05 ]

do i need to put deveject in the same folder as the eject usb?
[ 13 August, 2008 ] • [ dude ] • [ 06:51:11 ]

additional question:

do i need to put all the extra app (bold ones) inside ejectusb folder?
currently these are the bold ones that i can see (see below), only unlocker and sync are the two that i put inside ejectusb folder.

EjectMedia.exe
Sync.exe
RemoveDrive.exe
DevEject.exe
handle.exe
Unlocker.exe

what does it mean that it can interfaced? should i put the apps inside the folder?

thanks for the great app
[ 13 August, 2008 ] • [ dude ] • [ 07:11:04 ]

je le veux
[ 13 August, 2008 ] • [ maximebergeron ] • [ 09:16:44 ]

Your blog is interesting!

Keep up the good work!
[ 17 August, 2008 ] • [ AlexM ] • [ 16:33:00 ]

I use W98SE and I have two programs which are similar but not identical (one on my hard drive and the other on my USB sticks).

I would very much like to try your program and I would like to ask, should any conflict arise, can I uninstall or delete your program?

I would add that I definitely need my original programs so it is coexistence which matters.

My regards
[ 25 August, 2008 ] • [ Mike ] • [ 10:26:36 ]

Is there a way to add command line switches to the External Utility Support? I was specifically looking at "USB_Disk_Eject.exe /REMOVETHIS /SHOWEJECT" I would like to use this External Utility because it promptly removes the USB drive, but it does not give me a notification when it has been removed.
[ 19 September, 2008 ] • [ MikeT ] • [ 11:01:09 ]

Hello,

i haven't the same ejection on xp and vista...
On vista my usb stick stay lit when she switched off on xp ... I preferred before !
Could it be that even extinguish it with Vista?

thanks for this very good and free app.
[ 30 September, 2008 ] • [ Totoche ] • [ 14:39:10 ]

thakyou
[ 04 October, 2008 ] • [ thanh ] • [ 20:54:22 ]

Hey, this is just great! God only knows how long I have been looking for a little utility like this! Especially my ancient Lexar JumpDrive with the secure partition does not take kindly to suddenly being jerked out of the USB port because nothing in the world will stop it. I have tested EjectUSB several times, and despite the warning messages everything turns out just fine. Thanks so much for making this program available for free!!
[ 05 October, 2008 ] • [ beattheswiss ] • [ 07:14:09 ]

at home I have a decent virusscanner (NOD32), installed it.

this is a beautiful piece of software! thanks a lot!!!!!!!!!

wow, you even thought of a no-eject setting! this is great, now I can close all open apps before firing up my backup program!!!!

thanks again!!!

tony
[ 08 October, 2008 ] • [ tony ] • [ 14:48:50 ]

Also have the MacAfee issue. Detected as a generic.dx trojan. Any ideas?
[ 09 October, 2008 ] • [ foobar ] • [ 07:14:47 ]

Yeh I have the same problem. EVEN bigger issue, as the uni im at runs Macafe, and auto deletes the exe in insertion! grrrrrr!
[ 09 October, 2008 ] • [ relequestual ] • [ 12:46:49 ]

McAfee temporary workaround:

McAfee false positive is related to UPX code, which is opensource compression code. The script wrapped without UPX generates a bigger .exe, but without false positives in McAfee

it is explained in this forum:
http://www.autoitscript.com...

the REAL solution is to:

contact McAfee, and politely inform them their AntiVirus generates false positives. send them the EjectUSB.exe, and point them to this page where they can check the errors, source, contact the author etc.

please DO contact McAfee, they probably wont give much priority on 2 or 3 error reports. more is better in this case!

thanks!
[ 13 October, 2008 ] • [ tony ] • [ 03:55:31 ]

ehm, listed SyncBack in the [exclusions] list but still gets closed.
pstart is closed too btw.

am I doing something wrong?
[ 13 October, 2008 ] • [ tony ] • [ 11:35:27 ]

Hi,

Any Hybrid batch script example available?
[ 15 October, 2008 ] • [ Gig ] • [ 08:44:41 ]

Hi, I'm currently using a Truecrypt volume on a usb drive running geek.menu (a PortableApps fork). geek.menu allows me to configure an ejection application to be run when I click on the eject option but it is only able to run the application once. It is capable of passing both the usb drive and the truecrypt drive to the application as parameters.

My current solution (currently untested due to lack of space) is a batch file (i run this directly from geek.menu, not via ejectusb) which first runs noejectusb.exe x: (renamed copy of ejectusb.exe) with donoteject=1 in the noejectusb.ini to close all the apps on the truecrypt volume, unmount the truecrypt volume using truecrypt.exe and then run ejectusb.exe w: to unmount the usb drive. This takes up too much space since there's 2 copies of the exe and the free space on the actual usb drive isn't enough due to the large truecrypt volume file.

Will it work with just one exe and one ini file with donoteject=1 and then just run ejectusb.exe x: to close apps on the truecrypt volume and then run ejectusb.exe /eject w: to close all apps on the usb drive and eject it? Will this method actually close the apps running on the usb drive and flush it as well?

Or, for the most elegant solution I can think of, is there a way to specify multiple drive letters to eject and have different hybrid batch files for each drive? I'm trying to find a way to call ejectusb.exe directly and give it 2 drive letters like this: "ejectusb.exe x: w:" and let ejectusb.exe close the apps on the truecrypt volume, run a .bat file for the truecrypt volume to unmount it eg: "ejectusbtruecrypt.bat x:" and then do the normal eject stuff for the usb drive.

The drive letters btw may be different and are provided by geek.menu to the eject script/application via command line.
[ 20 October, 2008 ] • [ jaybz ] • [ 22:35:44 ]

thanks
[ 22 October, 2008 ] • [ Nobunaga ] • [ 19:59:58 ]

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

Add Comment