Author Topic: IDrive.VolumeName Property  (Read 3299 times)

0 Members and 1 Guest are viewing this topic.

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2517
  • User-Rate: +209/-0
  • Gender: Male
IDrive.VolumeName Property
« on: July 14, 2008, 04:32:54 AM »

The following code illustrates the use of the VolumeName property:

JScript

Code: [Select]
function SpaceReport(drvPath)
{
   var fso, d, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   d = fso.GetDrive(fso.GetDriveName(drvPath));
   s = "Drive " + drvPath + " - ";
   s += d.VolumeName + "<br>";
   s += "Total Space: "+ d.TotalSize/1024 + " Kbytes <br>";
   s += "Free Space:   " + d.FreeSpace/1024 + " Kbytes";
   return(s);
}

VBScript

Code: [Select]
Function ShowVolumeInfo(drvpath)
   Dim fso, d, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set d = fso.GetDrive(fso.GetDriveName(fso.GetAbsolutePathName(drvpath)))
   s = "Drive " & d.DriveLetter & ": - " & d.VolumeName
   ShowVolumeInfo = s
End Function


PowerBASIC

Code: [Select]
FUNCTION ShowVolumeInfo (BYVAL drvPath AS STRING) AS STRING

   LOCAL fso AS IFileSystem
   LOCAL d AS IDrive
   LOCAL s AS STRING
   
   fso = NEWCOM "Scripting.FileSystemObject"
   d = fso.GetDrive(fso.GetDriveName(fso.GetAbsolutePathName(UCODE$(drvpath))))
   s = "Drive " & ACODE$(d.DriveLetter) & ": - " & ACODE$(d.VolumeName)
   FUNCTION = s

END FUNCTION