Button code for Safely Remove USB (pen flash drive)

Dear Sirs,

is there any easy way (e.g. Dopus button code or Dopus rightclick context menu) to disconnect removable USB drives (thumb drive, pen drive, flash drive, usb memory stick)? The standard and safe way to eject them under WindowsXP is by "Safely Remove Hardware" (green arrow in system tray, notification area).. which works superfine but costs 5-6 (right/left mouse) clicks.

i am too noob :blush: that i would know if and how Dopus (button/context menu) does such a thing.

Thanks for some help with this task.
Best regards
placebo

I usually right-click the drive-letter on my toolbar, then choose Eject.

If you want, you can create a button which "ejects" a particular drive:

Go D: EJECT

You should also be able to make a button which ejects the current drive using Go {sourcepath|} EJECT (it might also need a command before it to change drives so the current one isn't in use; not sure).

Thanks leo, works to some degree!

When i right click on Dopus toolbar icon (drive bar) and do "Eject", in Dopus the drive vanishes. In Windows Explorer the drive icon is still there (without drive name) and when i click on it, it says "Please insert disk". The Safely Remove Hardware dialogue continues to list/show the USB drive. I am interpreting this contradictory situation/state as "the drive is logically disconnected from access but it is physically still connected to the PC, i.e. the USB connector still gets amperes".

Best far we can get, thanks again!

I think in that situation (unless the device has multiple logical drives and only one has been ejected), it is safe to remove.

Sometimes the drive and the USB device are seen as two separate things, so you can eject the drive but the USB device that it lives on is still plugged in (but safe to remove, as the drive is no longer mounted).

At least, that's my understanding.

The OS should complain if the device is removed before it is ready, too.

hello. the following makes things clearer (and i am not talking sh*t :wink: ) FWIW:

  • When i "eject" the pen drive with Dopus context menu (and it is indeed not accessible anymore thru dopus.exe nor thru explorer.exe as described earlier) and leave the pen physically plugged in the USB2.0 slit and wait hours before i manually remove the pen, the pen is still warm at the connective area (my USB-pen drive is made from metal :thumbsup: ). This is explained easily: the pen still gets electrical current/voltage from the PC (as can be seen thru the Safely Remove Hardware dialogue where the drive is still being listed as plugged/connected/unremoved USB device), thus it can develop heat.

versus:

  • When i "disconnect" the pen drive with Safely Remove Hardware dialogue and wait hours until i manually remove the pen, the pen is as cold as my §$%&! little work room. This is explained easily too: the PC cuts off the voltage (and current) to the pen. Thus no further electrical energy transfer (and conversion to thermal energy) possible. (side note: I own an external HDD which, when i do the safely remove procedure, actually spins down. Completely stops the hdd disc rotation. To cut it off entirely from external power supply i still have to press the on/off-power switch of the external HDD.).

yeah.. i am taking a degree on thermodynamics lol.

Hi Plunder,
To really cool your stick down you could try the commandline-Tools "RemoveDrive V2.2" and "RestartSrDev" from this site:
http://www.uwe-sieber.de/drivetools_e.html

You can safely remove a device by Driveletter or you can use it's "friendly name" (wildcards supported)
This will remove all Sticks with "Sandisk" in their name:

removedrive *Sandisk* -L

With "RestartSrDev.exe" you can restart the stick.

[quote="kundal"]removedrive *Sandisk* -L
With "RestartSrDev.exe" you can restart the stick.[/quote]
Hi kundal, i've copied RemoveDriveWin32.exe to my Windows folder and this is how my final button version literally looks like:"C:\Programme\D-Tools\daemon.exe" -unmount 0 "C:\Programme\D-Tools\daemon.exe" -unmount 1 "C:\Programme\D-Tools\daemon.exe" -unmount 2 "C:\WINDOWS\RemoveDriveWin32.exe" I: -L "C:\WINDOWS\RemoveDriveWin32.exe" G: -L Go DISCONNECT
(I:) and (G:) are typically the drive letters assigned either to my external USB hdd or to my USB stick or both. the -L switch is of paramount importance.. otherwise i must click the button twice (yikes). While Go I: EJECT does some appropriate action, "C:\WINDOWS\RemoveDriveWin32.exe" I: -L does the full hardcore action. Fully disconnects the power/voltage/current to the USB2.0 face. Works really great!

Thanks a lot for the freeware tip!!

@Plunder:
Thanks to you! I'd never have done a Google-Search for this tool without you posting this topic.

Did you notice the other tool "RestartSrDev" on the site? You can restart "safely removed" devices with it without plugging your device out and in again. Nice to have it as RMB-Command in a three-way Button.
To restart a specific device you'll need to know the "device instance ID" of the device which you can find this way:
Right-click the device=>Properties=>Hardware=>doubleclick your device=>Details=>choose "Superior" (german: Ãœbergeordnet).


For my Sandisk Stick the command looks like this:

RestartSrDev USB\VID_0781&PID_5567\200601653318CEA077BB

To restart all "safely removed" devices currently plugged in to you Computer you can simply use this:

RestartSrDev *

Fine detailed instructions (better than that webpage) thanks very helpful. Yes i noticed that RestartSrDev.exe tool. I have no use for it or was never looking for such a functionality. I eject/disconnect USB drives with Safely Remove with the aim of unplugging the physical mobile device manually and put the thing away.

The only instance where it would make real practical sense is: you had disconnected all USB devices with the 1-button and this included the ejecting of a USB printer (hp, canon, epson; you remove your mobile devices like mp3-player and USB pen drives but need to restart the USB-connection to your Epson printer. This you would do with the RestartSrDev.exe button.

My "button" is in the menu [i]ListerMenu /i: Tools >> Disconnect All. Since it's not a standalone button, i cant assign any right- or middle-click mouse button anyway. i am saved! :wink:

Have a great day everybody! Cheers.

You can have three-buttons within menus. They're not restricted to the top-level of toolbars.

Errare humano est.
I didnt realize/know it until now. Learned something new about DO10 :blush:, thanks for correcting/enlightening me (and i am wondering how many Dopus10 users are 100% aware of it).

This gives me now the opportunity to redesign some of my menu (ListerMenu DO9) entries.. Time to play again with Dopus configuration and preferences, yay!!

And sorry for my ignorance. (be it as it may, i dont think that i will install that RestartSrDev.exe tool; i dont find it very useful..). Thanks so much again to both of you!

I think apart from only safely removing devices these tools are especially useful to save energy when you want to have an external drive permanently connected to your computer.
When started fom a DOpus-Button they provide a comfortable way to safely remove the drive to save energy and reconnect it when needed without having to plug it out and in again.

Hmmm - this thread reminded me to work on a button that would WAKE UP sleeping USB attached drives that have poweered down after not having accessed them for awhile - so that I can then disconnect them before undocking a laptop from teh docking station. Otherwise - there are times where the drive(s) (several Seagate FreeAgent Desktop external USB HDD's) have gone to sleep, and if I just try to undock the laptop, it's got to wake the drives up, then auto-disconnect them before the un-dock can complete - and sometimes it doesn't work. It's sooooo annoying when this happens that I've just taken to manually expanding the drive letters, waiting for them to expand, and then existing Opus (sometimes having Opus open seem to block the disconnect of some USB drives) - all before trying to safely UNDOCK the laptop. Sometimes - even trying to manually disconnect the devices before the UNDOCK encounters the dreaded "Device cannot be stopped" message - even though there is apparently nothing touching the drive from either Handle, Unlocker, or ProcMon. Weird... but going in steps usually prevents it - otherwise it's time to just do a shutdown... :frowning:

FWIW While it's very true that the Dopus button with removedrive.exe does safely remove the attached drives (external hdd, mp3-player in UMS mode, usb memory sticks or pen flash drives) from the system tray notification area, i think i am wrong with the statement about the voltage. My external hdd spins down when i press the Dopus button so everything's perfect here!, on the other hand my UMS mp3-player does not shut down (turn off power). So there must be some "minimal connection" left from the mp3 player to the PC. It's certainly not a data connection but some other kind of connection left. Once i plug the USB-cable out, then the mp3-player would finally shut down.

I will verify if that minimal connection is still used for recharging the mp3 player's battery. That's how a mp3-player is recharged: by connecting its data cable to the USB port of your home PC...

Hi Leo,

I was interested in adding this feature too.
When I add the following command "Go {sourcepath|} EJECT" in a new button, the button is grayed out.
As a workaround, I have added @async in front of the command and now it works.

Do you know why the command "Go {sourcepath|} EJECT" by itself is not valid ?

Thanks

[quote="leo"]I usually right-click the drive-letter on my toolbar, then choose Eject.

If you want, you can create a button which "ejects" a particular drive:

Go D: EJECT

You should also be able to make a button which ejects the current drive using Go {sourcepath|} EJECT (it might also need a command before it to change drives so the current one isn't in use; not sure).[/quote]

Use Go CURRENT EJECT instead. That seems to do the same thing without being disabled.

Simply Go EJECT by itself (with no path specified) should work too, but we'll make it work with {sourcepath} as well in the next version.

thank you,

It's been some years I use it now, but I wanted to say I LOVE dopus :slight_smile:
best piece of software I ever used. best manual, best options, best support.... I love how it can be customised, there is something for everyone in it.

Thanks guys !

Thanks!

Best users, too! :slight_smile:

[quote="megosu"]thank you,

It's been some years I use it now, but I wanted to say I LOVE dopus :slight_smile:
best piece of software I ever used. best manual, best options, best support.... I love how it can be customised, there is something for everyone in it.

Thanks guys ![/quote]
Couldn't of said it better myself. I agree 100% ! :smiley: :thumbsup: