I got this from a newsgroup post, but neglected to record who gets the credit for it. If I were to guess, I would say Walter Zachary.
Option Explicit
Dim Shell
Dim System
Dim Count
Dim Drive
Set System = CreateObject("Scripting.FileSystemObject")
For Count = Asc("d") To Asc("z")
If System.DriveExists(Chr(Count)) Then
Set Drive = System.GetDrive(Chr(Count))
If Drive.DriveType = 4 Then
On Error Resume Next
Set Shell = CreateObject("Shell.Application").NameSpace(17)
Shell.ParseName(Drive & "\").InvokeVerb("e&ject")
Exit For
End If
End If
Next 'Count
Set Shell = Nothing
Set System = Nothing
--
Bill James
Microsoft MVPDTS
?Free Win9x VBScript Utilities?
http://www.svvi.net/wgjames/vbspage/
Quote:
> Is it possible to eject my cd drive from a vbscript fil ?
> Jens from Denmark