dreamz - 24 Dec. 2006 - 21:23:
safely remove hardware: stopping a usb flash drive from the command line
i use my flash drive regularly to back up important documents, so the whole routine of going through the safely remove hardware dialog to stop the drive can be tedious.
is there a way to automate all of this with some sort of script so that it will automatically power down and disconnect the flash drive without 1) requiring me to go through the dialog, and 2) without installing extra apps?
thanks, and happy holidays!
I don't know about the stopping business, but at least I know what command to use to get the Safely remove hardware dialog to open up.
c:windowsSystem32RUNDLL32.EXE shell32.
dll,Control_RunDLL hotplug.dll
I don't know if it is possible to say exactly what drive to remove because it can vary... I hope it help you somewhat anyway.
right click on flash drive > on hardware tab, select your flashdrive > double click > and choose policies. here you can select "optimize for quick removal".
"this setting disables write caching on the disk and windows, so you can disconnect this device without using the safe removal icon."
i used to use plug and unplug my brother's flash drive. never used the safe removal dialog yet.. etc...
thanks for the replies, guys.
@henrik: the drive letter will always be the same because i'm always connecting the same devices in the same order, but i don't know how to specify the drive with that command, and, like you said, it may or may not be possible. if a drive can be specified, though, that would be ideal.
@des: i didn't start using the safely remove hardware dialog until recently, but since i have some really important documents on the drive, i don't want to take any chances.
actually, i searched for a few hours and i came across two similar apps, deveject and removedrive.
deveject:
http://www.jsifaq.com/SF/Tips/Tip.aspx?id=8496
removedrive:
http://www.uwe-sieber.de/usbstick_e.html
i should be able to write some batch files and call those apps. i haven't tried it yet, and it's not ideal (as i was hoping to do it natively in xp), but if it works, i'll be satisfied. i'll try them today.