实现获取磁盘的详细信息(容量、状态、签名)!
求指导!

解决方案 »

  1.   

    要调用 api,网上很多方法的
      

  2.   

    参考
    http://developer.51cto.com/art/200908/146032.htm
      

  3.   

    调用api,自己去百度找资料去看
      

  4.   

    添加引用
    using System.IO;使用获取磁盘信息
    DriveInfo[] myDrives = DriveInfo.GetDrives();
      

  5.   

    用 System.IO 命名空间下的 DriveInfo类
    DriveInfo[] allDrives = DriveInfo.GetDrives();//检索计算机上的所有逻辑驱动器的驱动器名称        foreach (DriveInfo d in allDrives)//循环输出各分区的信息
            {
                Console.WriteLine("Drive {0}", d.Name);
                Console.WriteLine("  File type: {0}", d.DriveType);//驱动器类型
                if (d.IsReady == true)
                {
                    Console.WriteLine("  Volume label: {0}", d.VolumeLabel);//分区的卷标
                    Console.WriteLine("  File system: {0}", d.DriveFormat);//分区的文件系统类型
                    Console.WriteLine(
                        "  Available space to current user:{0, 15} bytes", 
                        d.AvailableFreeSpace);//指示驱动器上的可用空闲空间量。                Console.WriteLine(
                        "  Total available space: {0, 15} bytes",
                        d.TotalFreeSpace);获取驱动器上的可用空闲空间总量                Console.WriteLine(
                        "  Total size of drive: {0, 15} bytes ",
                        d.TotalSize);获取驱动器上存储空间的总大小
                }
            }