tags:

views:

47

answers:

1
while [1 = 1]
do
eject
sleep 1

eject -t
sleep 1
done

And this is said to be the same:

watch -n 1 eject -T

What does it do?What's the equivalent in batch?

A: 

you can try this vbscript

Const CDROM = 4
Set objFS=CreateObject("Scripting.FileSystemObject")
Set shell = CreateObject("Shell.Application")
For Each drives in objFS.Drives
  If drives.DriveType = CDROM Then
    cd=drives.DriveLetter & ":\"    
    'Eject           
  End If
Next
Do
 shell.Namespace(17).ParseName(cd).InvokeVerb("E&ject") 
 WScript.Sleep 1000 'in ms
Loop While 1=1

save as eject.vbs run it as

c:\test> cscript //nologo eject.vbs
ghostdog74
It's not working for my laptop
symfony
This horrible code will "click" the eject item in the right click menu, if your OS is not English, it will fail! It is also possible to invoke verbs with the "internal" name, not sure if those names are also language specific.
Anders
if its so "horrible" like you said, why don't you provide the solution. at least i am trying to help, but you only know how to criticize.
ghostdog74