WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Check CDROM Ejected


Question:

How can i check the state of the DVD rom drive. Open or closed ?

Answer:

The IsReady property seems to handle it:

http://msdn2.microsoft.com/en-us/library/ms723221.aspx

Sample code:

#DefineFunction ShowDriveInfo(drvpath)
    fs = CreateObject("Scripting.FileSystemObject")
    d = fs.GetDrive(drvpath)
    Select d.DriveType
        Case 0
         t = "Unknown"
         Break
        Case 1
         t = "Removable"
         Break
        Case 2
         t = "Fixed"
         Break
        Case 3
         t = "Network"
         Break
        Case 4
         t = "CD-ROM"
         Break
        Case 5
         t = "RAM Disk"
         Break
    EndSelect
    s = "Drive " : d.DriveLetter : ": - " : t
    If d.IsReady Then
        s = s : @CRLF : "Drive is Ready."
    Else
        s = s : @CRLF : "Drive is not Ready."
    End If
    Return s
#EndFunction

ret = ShowDriveInfo("D:")
Message("ShowDriveInfo", ret )
Exit

Article ID:   W17191
File Created: 2007:07:03:14:28:40
Last Updated: 2007:07:03:14:28:40