Author Topic: IDrive.ShareName Property  (Read 2964 times)

0 Members and 1 Guest are viewing this topic.

Online José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2517
  • User-Rate: +209/-0
  • Gender: Male
IDrive.ShareName Property
« on: July 14, 2008, 05:10:57 AM »

The following code illustrates the use of the ShareName property:

JScript

Code: [Select]
function ShowDriveInfo(drvpath)
{
   var fso, d, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   d = fso.GetDrive(fso.GetDriveName(fso.GetAbsolutePathName(drvpath)));
   s = "Drive " + d.DriveLetter + ": - " + d.ShareName;
   return(s);
}

VBScript

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

PowerBASIC

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

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

END FUNCTION