운영 체제의 드라이브 정보에는 다음이 포함됩니다.
Drive Name Volume Label Free Space Total Size Drive Format Drive Type
드라이브에 대한 위의 정보를 얻으려면 다음 코드를 실행하십시오 -
예
using System.IO;
using System;
class Program {
static void Main() {
DriveInfo driveInfo = new DriveInfo("D");
Console.WriteLine(driveInfo.Name);
Console.WriteLine(driveInfo.VolumeLabel);
Console.WriteLine(driveInfo.AvailableFreeSpace);
Console.WriteLine(driveInfo.TotalFreeSpace);
Console.WriteLine(driveInfo.TotalSize);
Console.WriteLine(driveInfo.DriveFormat);
Console.WriteLine(driveInfo.DriveType);
}
} 출력
다음은 출력입니다 -
D: NTFS 76767677788 76767677788 45463434799 NTFS Fixed
참고 − 출력은 운영 체제에 따라 다를 수 있습니다.