Removal of USB Disk under Command Line Control

  • Thread starter Thread starter Pegasus \(MVP\)
  • Start date Start date
P

Pegasus \(MVP\)

I am using a number of external USB disks for data
backup. The backup process is controlled by a scheduled
batch file.

Does anyone know how to disconnect such a drive
with a command (rather than via the usual GUI)
so that the user needs to do nothing other than
unplug one drive and plug in another?
 
Pegasus said:
I am using a number of external USB disks for data
backup. The backup process is controlled by a scheduled
batch file.

Does anyone know how to disconnect such a drive
with a command (rather than via the usual GUI)
so that the user needs to do nothing other than
unplug one drive and plug in another?
Hi,

To automate this, you can use deveject.exe available here (includes
C++ source code as well):

ftp://ftp.heise.de/pub/ct/listings/0316-208.zip

For help, run deveject.exe /? in a command prompt.

Works for Windows 2000/XP/2003.


An example using the EjectName command line switch:
deveject.exe -EjectName:"USB Mass Storage Device"


Here is the readme.txt file, translated from German to English (by me):

DevEject -- Safely remove hardware automatically, for Windows 2000/XP/2003
=================================================================

DevEject enables you to programmatically stop mass storage devices such
as FireWire disks or USB-sticks

DevEject.exe -- the compiled executable
DevEject.cpp -- Source code in C++
 
Torgeir Bakken (MVP) said:
Hi,

To automate this, you can use deveject.exe available here (includes
C++ source code as well):

ftp://ftp.heise.de/pub/ct/listings/0316-208.zip

For help, run deveject.exe /? in a command prompt.

Works for Windows 2000/XP/2003.


An example using the EjectName command line switch:
deveject.exe -EjectName:"USB Mass Storage Device"


Here is the readme.txt file, translated from German to English (by me):

DevEject -- Safely remove hardware automatically, for Windows 2000/XP/2003
=================================================================

DevEject enables you to programmatically stop mass storage devices such
as FireWire disks or USB-sticks

DevEject.exe -- the compiled executable
DevEject.cpp -- Source code in C++
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

Nice one - thanks for your help. My previous eject tool
(eject.exe by WebGeek) worked fine for CD/DVD drives
but failed for USB drives.
 
Glad you got your solution.

FWIW (at least a chuckle) Kelly and Yves (the content free respondents)
have blessed the NG with 3 posts each since June 2004.

Yves' other 2 posts were intended to help the OPs, and maybe did.

Only one of Kelly's 2 other posts is still readable in my reader, and
it's a one liner telling the OP (whose question was about W2kSP4) that
"This is an XP newsgroup." Of course that's wrong.

Kelly runs an XP tipsntricks-type website that I'll bet is full of stuff
pasted from these NGs. Whether it is or not, I hope the material in it
is not so blatantly bad as Kelly's only other 'contribution' to this NG.

Neither of these characters is what I'd call a stellar contributor like
yourself! LOL :-)
 
In
Yves Leclerc said:
If your are a MVP, shouldn't you already "know" the answer?


Microsoft's MVP award doesn't provide instant omniscience to the
awardee. First, MVPs all have different areas of interest and
knowledge. Second, none of us knows everything, not even in our
particular areas.
 
FWIW (at least a chuckle) Kelly and Yves (the content free respondents)
have blessed the NG with 3 posts each since June 2004.

You might want to look at the Newsgroups line before you go on
about "the NG" and "this newsgroup". :-)

I have to admit that Kelly's responses the last few days have
seemed less helpful than I might wish, but we should cut her some
slack as she's recovering from a huge natural disaster and she is
usually extremely helpful. Try googling for her in her usual place,
microsoft.public.windowsxp.general (which is where I'm reading your
note). and you'll see she is one of the most frequent people
providing answers.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
"To put it bluntly but fairly, anyone today who doubts that the
variety of life on this planet was produced by a process of
evolution is simply ignorant -- inexcusably ignorant, in a world
where three out of four people have learned to read and write."
--Daniel Dennett, /Darwin's Dangerous Idea/ (1995), page 46
 
I'm corrected on Kelly's comment; I missed the crosspost to the XP
group; see above. I guess Kelly doesn't spend much time (if any) in the
ms.p.w2k.gen, which is dandy...and perhaps she too missed the crosspost...?

In any event, I hope Rita doesn't further unnerve her.
 
I know a few things very well and about many others
I know much less. I suppose Microsoft made me an
MVP because of the former, regardless of the latter.
 
Thanks, Dan. What is odd about Rita is that the folks we sent for shelter
via Texas are now looking to come back "here" for shelter.

--

All the Best,
Kelly (MS-MVP)

Troubleshooting Windows XP
http://www.kellys-korner-xp.com

In memory of those lost during Katrina &
Prayers and Hope for the remaining displaced.
 
Hey, I invented that one myself! Maybe I should
join the Poets' Society instead of pretending to be
a competent MVP . . .
 
In
Pegasus (MVP) said:
Hey, I invented that one myself! Maybe I should
join the Poets' Society instead of pretending to be
a competent MVP . . .


Most Voluble Poet? ;-)
 
Back
Top