Eject USB

I would really like to right click a removable drive ('Removable Drives' button) to 'safely remove hardware' (eject). Been searching and Nirsoft plugins apparently can do it, but I would still be lost on how.

I saw an Opus option regarding drive ejection.
Close Tabs On Eject

And I found some interesting Windows 10 files about this:
Safely Remove Device

Which has another file in that folder, named 'activation'. That looks useful
Activation Store

So does Opus have some kind of internal 'eject usb' somewhere? That I could add to the pre-existing 'removable drives' button as a right click?

The Go command can be used to eject a removable device, it's really designed for CD/DVD media - it does the same thing as right-clicking the drive icon and choosing 'Eject' from the context menu - but it might work on a USB stick too. Probably depends on the device itself.

E.g. to eject drive F:, Go F: EJECT.

1 Like

Nah, that didn't work.
It wouldn't make the three button for me either. When pushing ok on the customize mode, it ejected (pun intended) my newly made right click button out of it.
Other Drives

Ideally any drive that pops up as a removable drive could have an eject on right click. Or in its context menu at least. (oh, that might be why three button doesn't work, because drives always need to have context menus).

Looks like I will have to try this the hard way. Or just keep right clicking the windows taskbar tray icon, like I'm still living in 1998.

I was able to get it with NirSoft's USBDeview.

Copied the USBDeview files to C:/Windows. Made a system wide hotkey with that command line.
USBDeview.exe /stop "(device name)"

For everyone else: That is my specific device. You will have to put in the name of your own device instead. Find the proper name by running that same USBDeview app.
Command Line
Put that hotkey on my keyboard on my G6 key.

Pushing the G6 key ejects it fine. Odd that in the NirSoft usb viewer app, it says that device is 'safe to unplug' (without having to eject it).

I have the 'Close tab on device eject' enabled and that works too:
Close Tab

Although I would much prefer to be able to add a custom command to its right click context menu. Instead of having a shortcut use up a button on my keyboard.
Drives seem to have their own private context menu and I'm not sure how to edit them:
Context Menu

I would just add an 'Eject' entry to it that would run that same command as above and it would work.
Also that 'Format...' option is dangerously close to other useful options.
Just like Microsoft folder and file menus put 'delete' right next to 'rename'. You know how many times I've deleted something when trying to rename it?

I got it.

It's in the file settings. The 'Drive protocol':
Drive Protocol

In the context menu, add a new file type:
Context Menu 2

Under the tab 'Run Application', use that same command line (with the correct drive name):
Run Application

Presto! Works like a charm! :smiley:
Eject Context Menu

An alternate solution two click solution:

Create a button with the following commands:

<?xml version="1.0"?>
<button backcol="none" display="both" icon_size="large" label_pos="right" textcol="none" type="menu">
	<label>All Drives</label>
	<icon1>/dopusdata/User Data/Hard Drive.ico,0</icon1>
	<button backcol="none" display="both" icon_size="large" label_pos="right" textcol="none">
		<label>Device</label>
		<tip>Lists a Button for Each Drive</tip>
		<icon1>#drivebuttons</icon1>
		<function type="normal">
			<instruction>Go DRIVEBUTTONS=iconlettersoff</instruction>
		</function>
	</button>
</button>

Running it yields:

Right click on the USB drive to get an Eject option:

1 Like

I use this button using the command line of USB Safely Remove or Zentimo (Same developer, the functions change, but the command line is the same) Maybe if you only use the command line no license is required.

This is for zentimo:

@set driveletter = {sourcepath$|\}
Go /thispc 
"/programfilesx86\Zentimo\usr.exe" STOP -d {$driveletter} > %TEMP%\USRResult.txt
SHOW PLUGIN=text %TEMP%\USRResult.txt

Just go to any folder on the pendrive or select in the folder tree and press the button. Don't work in ThisPC folder

The original post where I got inspiration

1 Like

Looks like these things were dealt with long ago, I just didn't find the solutions. :roll_eyes:

I like the idea of having an omni "wildcard" eject, for whatever removable device that I click on.
Trying out your button and I'm not getting an eject option on the right click menu, just as I didn't have one before. I noticed 'Bitlocker' on your menu, so that tells me you have a Windows Pro edition. I only have Home, so that might be why. (Pro edition might give me my right click 'send to - email' too, come to think of it)

That software looks useful. Looks really old though.
I like it being able to show me what is "using" the drive. And the ability to power down a stopped drive. And restart one. Except mine are all on powered usb hubs so I have to press the physical buttons anyway.

Thanks for the tips, guys. :blush:

2Asunder

Windows is quite fiddly as to what deserves to get an Eject option. In the screen shot of the drive list in my earlier post, "J" is a flash drive plugged into the front USB port on the computer, "K" is an external hard drive plugged into a hub and "L" is a Flash drive plugged into a hub. Ja nd L have an eject option although the icons chosen by Windows are different. Only small USB drives are USB drives but it is unclear how small small is.

You can use Device Manager to turn off the write cache in USB drives. Then, you can pull out the drive at will.

Nice. I didn't know that option was there. Odd, my E drive was already set for quick removal.
E Properties
That explains why uSBDeview was telling me it can be removed without an ejection.
Guess I didn't need a custom eject button anyway. Don't know why the windows icon on the taskbar would exist then.
Think I like the sound of 'better performance' though.
I enabled cache and it still didn't give me an eject option. But I have the custom one already made.
Although I think this puts the drive into unnecessary risk of corruption.

Coincidentally stumbled over this thread whilst having issues with an external usb drive, being locked by: svchost.exe (Service: TrkWks)

Initially I tried with the "Go" command button, but I couldn't get it working: it remained greyed out.

FWIW...only
there is a free, portable, open source tool USBDiskEjector1.3.0.6
One might create a button like:
X:\USBDiskEjector\USB_Disk_Eject.exe /REMOVELETTER R
(see review on Softpedia)

1 Like

Trying this with multiple removable drives now. I have my original hard disk, and now a usb stick.
It's oddly not working for me now.

Stop D Not Working

The E: one is still working, but the D: one isn't. I tried my custom drive name, and also the factory name (as shown in pic, for both drives). Not sure why it isn't working.