Hi, i'm trying to make a batch file that work from a usb drive
the batch will close the running programs on the usb and then eject the usb
my problem in the eject part ... what is the command for ejecting the usb drive.
i searched and many say there is no command but then how the windows eject the device then?
help please
help what is the command that eject the usb drive [solved]
Moderator: DosItHelp
help what is the command that eject the usb drive [solved]
Last edited by abc0502 on 12 Mar 2012 00:33, edited 1 time in total.
Re: help what is the command that eject the usb drive
'
Eject ? On a USB ?, you mean safely remove, dunno but you may want to disable it
( same effect as safe remove, flushes all buffers to disk ).
You can use DevCon, available from http://www.ed-dyreen.com/eDOS%20beta%20 ... 7.11.2011/
Find the device for your class which is 'USB: USB-controllers' and disable the device.
something like:
You may want to try http://unattended.msfn.org/unattended.xp/ ( they also have a forum ).
You will find more information on those subjects there.
Eject ? On a USB ?, you mean safely remove, dunno but you may want to disable it
( same effect as safe remove, flushes all buffers to disk ).
You can use DevCon, available from http://www.ed-dyreen.com/eDOS%20beta%20 ... 7.11.2011/
Find the device for your class which is 'USB: USB-controllers' and disable the device.
something like:
Code: Select all
@echo off
DevCon.EXE /?
DevCon.EXE classes
DevCon.EXE help FindAll
pause
exit 0
Code: Select all
for %%! in ( "USB"
) do (
for /f "tokens=1* delims=: " %%A in ( 'DevCon.EXE FindAll ^=%%~! ^|findstr /i /c:":"'
) do (
set "ID=%%A"
set "DEVICE=%%B"
set "HWID=!ID:~0,21!"
)
)
"DevCon.EXE" disable !HWID!
You will find more information on those subjects there.
Re: help what is the command that eject the usb drive
Thanks for the help 
