Drive オブジェクト

ディスク ドライブまたはネットワーク共有の各種プロパティへアクセスする手段を提供します。

解説

次のコードは、Drive オブジェクトを使ってドライブのプロパティにアクセスする例です。

function ShowFreeSpace(drvPath)
{
   var fso, d, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   d = fso.GetDrive(fso.GetDriveName(drvPath));
   s = "Drive " + drvPath + " - " ;
   s += d.VolumeName + "<br>";
   s += "使用可能な領域 : " + d.FreeSpace/1024 + " KB";
   return(s);
}
[VBScript]
Function ShowFreeSpace(drvPath)
   Dim fso, d, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set d = fso.GetDrive(fso.GetDriveName(drvPath))
   s = "Drive " & UCase(drvPath) & " - " 
   s = s & d.VolumeName   & "<BR>"
   s = s & "使用可能な領域 : " & FormatNumber(d.FreeSpace/1024, 0) 
   s = s & " KB"
   ShowFreeSpace = s
End Function

メソッド

Drive オブジェクトには、メソッドはありません。

プロパティ

AvailableSpace プロパティ | DriveLetter プロパティ | DriveType プロパティ | FileSystem プロパティ | FreeSpace プロパティ | IsReady プロパティ | Path プロパティ | RootFolder プロパティ | SerialNumber プロパティ | ShareName プロパティ | TotalSize プロパティ | VolumeName プロパティ

参照

Drives コレクション | File オブジェクト | Files コレクション | Folder オブジェクト | Folders コレクション | GetDrive メソッド