Re: how do i remove a usb drive with a script?
- From: ToddAndMargo@xxxxxxxxxxx
- Date: 23 Mar 2007 09:22:32 -0700
On Mar 23, 1:50 am, Michael Bednarek
<mbATmbednarek....@xxxxxxxxxxxxxxxxx> wrote:
On 22 Mar 2007 15:09:58 -0700, ToddAndMargo@... wrote in
microsoft.public.win2000.registry:
I know this may not be the correct group to post this in,
but I figure you will all forgive me if it is not. ("devcon"
deals with the registry.)
I wrote a customer a batch script that backs up her
internal hard drive to an external USB hard drive.
Problem: she ALWAYS forgets to press the add/remove
icons and just jerks the cord out of the drive (she has three
drives that she rotates). I clear the error by
going into the device manager and doing a remove
on the external drive. (I fear showing her how to
use the device manager.)
Now, I know that there is a way to do this with "devcon" from
my script. Problem: I am not smart enough to figure out how.
Can some kind person tell me 1) the devcon command to
search for the external usb hard drive and 2) how to use
devcon the do the same thing I manually do in the device
manager?
AFAIK devcon allows you to disable a device, which has the effect that
it gets re-installed the next time it's seen. That's IMO not the
equivalent of "Safely Remove Hardware".
To bring up the GUI for "Safely Remove Hardware" from a script:
RUNDLL32.exe SHELL32.DLL,Control_RunDLL hotplug.dll
To actually remove/eject a device, I use:
deveject.exe -EjectDrive:E:
See <ftp://ftp.heise.de/pub/ct/listings/0316-208.zip>.
Note that parameters to deveject are case sensitive.
Further reading:
"DevEject Alternatives"
<http://portableapps.com/node/3160>
which i.a. points to:
<http://www.uwe-sieber.de/usbstick_e.html>.
--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
I did not know deveject existed. Thank you!
-T
.
- References:
- how do i remove a usb drive with a script?
- From: ToddAndMargo
- Re: how do i remove a usb drive with a script?
- From: Michael Bednarek
- how do i remove a usb drive with a script?
- Prev by Date: Re: how do i remove a usb drive with a script?
- Next by Date: Restting Default Registry Permissions - Win2K Pro
- Previous by thread: Re: how do i remove a usb drive with a script?
- Next by thread: Restting Default Registry Permissions - Win2K Pro
- Index(es):
Relevant Pages
|