Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
1  
Wayyyyyyyyyy too many clicks. –  rodey Apr 30 '10 at 19:37
    
Only two clicks in KDE :P. –  marcusw Apr 30 '10 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...) –  grawity May 2 '10 at 17:58
add comment

4 Answers

DevEject

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

Example: deveject -EjectName:"USB Mass Storage Device"
share|improve this answer
add comment

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 :)

share|improve this answer
add comment

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.

share|improve this answer
add comment

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)

share|improve this answer
3  
+1 for sync; IMO best option. –  squircle Apr 30 '10 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 '10 at 18:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.