System.Shell.Drive.volumeLabel Property
Gets or sets the volume label of the system storage device.
This property is read/write.
Syntax
propVal = System.Shell.Drive.volumeLabel(strVolumeLabel)
System.Shell.Drive.volumeLabel(strVolumeLabel)
= propVal
Parameters
strVolumeLabel [in]
strVolumeLabel [out]
Sets or retrieves the volume label.
Remarks
Administrator privileges are required to change the volume label.
This value is not guaranteed to be unique unless it is used with a drive letter identifier.
The label length is determined by the operating system. For example, NTFS allows a volume label to be up to 32 characters long. Note that null is a valid volume label.
Examples
The following example demonstrates how to get the total space of a storage device.
// --------------------------------------------------------------------
// 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
Send comments about this topic to Microsoft
Build date: 2/24/2010
Build type: SDK