5

I find dismounting a USB drive takes far too many mouse clicks for my liking. Is there are command line way of doing it (XP and Vista)?

Addition I have an eye condition that makes hand mouse coordination difficult so any suggestion that there aren't too many clicks will be downvoted as not answering my question.

However I use AutoHotkey a lot and one use case would be to call it from an AHK script. So if there is a way to code it in AHK that will do. Added this to the tags.

Further question - is it safe to remove a disk when the computer is a. on Standby or b. Hibernated. I recall that W2000 got uspet if you pulled a disk from a hibernated machine. Or is it better to explicitly dismount or sync before you hibernate or standby - prabably in a script.

3
  • 1
    Wayyyyyyyyyy too many clicks.
    – rodey
    Apr 30, 2010 at 19:37
  • Only two clicks in KDE :P.
    – marcusw
    Apr 30, 2010 at 19:54
  • fyi: There is no need to unmount drives that are in "Optimize for quick removal" mode (default for USB removable drives); in it, the cache is flushed every two seconds (IIRC). Only those which are set to "Optimize for performance" need to be unmounted. (On the second thought, this might not apply to NTFS pendrives...) May 2, 2010 at 17:58

4 Answers 4

10

USB Disk Ejector:

usbejector /removeletter g

sync from SysInternals:

sync -e g h

(Both of these only work with disks that have a letter assigned)

2
  • 3
    +1 for sync; IMO best option.
    – squircle
    Apr 30, 2010 at 22:01
  • will give them both a try.... Will accept if they work for me (which I am sure they will).
    – justintime
    May 1, 2010 at 18:44
2

Here's another free command line tool for removing USB drives:

RemoveDrive prepares drives for "Safe Removal" by commandline. It can let you run the command into a loop until it succeeds, and let Windows show the "Safe to Remove" balloon tip when it's done. (I'm using Console here if anyone's wondering.)

alt text

The software runs on Windows 2000, XP, or higher. It has 32- and 64-bit editions as well.


Personally, I would remove any USB drive before I let the machine sleep or hibernate, just to make sure all my data is safe inside the USB drive and there are no open file handles left.

1

You can use this simple script to make hotkey for quick ejecting disk .

; Eject USB

^+e:: Run "X:\Your\Path\To\sync.exe" -e [Your USB drive disks]

example:

; Eject USB

^+e:: Run "E:\Soft\SysinternalSuite\sync.exe" -e g h

And reload your autohotkey, press Ctrl+Shift+E :)

1

DevEject

Usage: deveject -EjectDrive:<Drive>|-EjectName:<Name>|-EjectId:<DeviceId> [-v] [-Debug]

Example: deveject -EjectName:"USB Mass Storage Device"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .