66
26
I'm constructing a backup script for Windows 7, and the last action I want it to perform is to safely "remove" the USB drive that it is backing up to. I am under the impression that plugging the drive into the same USB port all the time will keep the same DEV_ID (correct me if I'm wrong). With a command line (or PowerShell), how can I tell Windows to safely remove the hardware automatically without user input?
Just as a place holder, other OSes that may have a way to do this would be great to know as well.
Could you update title to be correct. I was looking for answers on removing USB "devices" not USB "drives". – None – 2015-04-10T12:43:18.560
6I have to admit disappointment by some of the “answers” below which clearly did not understand what is being asked and provided options that are obviously useless for the task of automation as asked.` ಠ_ಠ – Synetech – 2013-12-05T03:39:58.767
ockquote>
I am under the impression that plugging the drive into the SAME USB port all the time will keep the same DEV_ID, correct me if I'm wrong. That is correct. Windows treats a drive and the port it’s plugged into as an identifying pair. By plugging it into a different port (in which it has never been plugged), you will trigger Windows’ driver-installation function. Worse, if you have assigned a non-consecutive drive-letter to the volume, then plugging it into a new port will not retain that letter, and it will get the next available letter and you must assign a letter manually again.
– Synetech – 2013-12-05T03:44:03.3431(Oddly enough, if you plug a drive into a port and let Windows install drivers for it, then assign a non-consecutive drive-letter to it, then unplug it an plug in a different drive that is of the same make, model, and size, then Windows will treat it exactly as though you plugged in the previous drive again.) – Synetech – 2013-12-05T03:45:36.570