System.Shell.Drive.driveType Property

Gets the system storage device type.

This property is read-only.

Syntax

propVal = System.Shell.Drive.driveType()

  

Parameters

  • intDriveType [out]
    Retrieves the device type.

    Value Meaning
    undefined

    The drive type cannot be determined. For example, this value is returned if no network drive or removable drive is mounted for the drive letter specified.

    1

    Floppy drive.

    2

    Removable drive, such as a USB or cartridge drive.

    3

    Fixed drive.

    4

    Remote (network) drive.

    5

    Optical drive.

    6

    RAM disk.

     

Examples

The following example demonstrates how to get the storage device type.

// --------------------------------------------------------------------
// Display drive information.
// driveLetter: user input.
// --------------------------------------------------------------------
function GetDriveInfo(driveLetter)
{
    var sDrive = "";
    var drive = System.Shell.drive(driveLetter);

    if (drive)
    {
        if (drive.isReady)
        {
            sDrive = "Label:" + drive.volumeLabel + " for drive(" + drive.driveLetter + ")<br/>";
            sDrive += "FreeSpace: " + drive.freeSpace + "MB<br/>";
            sDrive += "TotalFreeSpace: " + drive.totalFreeSpace + "MB<br/>";
            sDrive += "TotalSpace: " + drive.totalSize + "MB<br/>";
            sDrive += "DriveType: " + drive.driveType + "<br/>";
            sDrive += "DriveFormat: " + drive.driveFormat + "<br/>";
            sDrive += "RootDir: [" + drive.rootDirectory + "]<br/>";
        }
        else
        {
            sDrive = "Drive (" + driveLetter + ") is not ready.<br/>";
        }
    }
    else
    {
        sDrive = "Drive (" + driveLetter + ") is not valid.<br/>";
    }
    spFeedback.innerHTML = sDrive;
}

Requirements

Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
DLL Sidebar.Exe version 1.00 or later

See Also

System.Shell.Drive

System.Shell

 

 

Send comments about this topic to Microsoft

Build date: 2/24/2010

Build type: SDK