本文介绍了如何找到系统的硬盘大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何找到我的系统和配置的硬盘大小?

how to find the hardDisk size of my system & configuration?

推荐答案

    {
    ManagementObjectSearcher mosDisks = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");
    foreach (ManagementObject moDisk in mosDisks.Get())
        {
        ShowWMIObject("Type: " , moDisk["MediaType"]);
        ShowWMIObject("Model: " , moDisk["Model"]);
        ShowWMIObject("Serial: " , moDisk["SerialNumber"]);
        ShowWMIObject("Interface: " , moDisk["InterfaceType"]);
        ShowWMIObject("Capacity: " , moDisk["Size"]);
        ShowWMIObject("Partitions: " , moDisk["Partitions"]);
        ShowWMIObject("Signature: " , moDisk["Signature"]);
        ShowWMIObject("Firmware: " , moDisk["FirmwareRevision"]);
        ShowWMIObject("Cylinders: " , moDisk["TotalCylinders"]);
        ShowWMIObject("Sectors: " , moDisk["TotalSectors"]);
        ShowWMIObject("Heads: " , moDisk["TotalHeads"]);
        ShowWMIObject("Tracks: " , moDisk["TotalTracks"]);
        ShowWMIObject("Bytes per Sector: " , moDisk["BytesPerSector"]);
        ShowWMIObject("Sectors per Track: " , moDisk["SectorsPerTrack"]);
        ShowWMIObject("Tracks per Cylinder: " , moDisk["TracksPerCylinder"]);
        }
    }

private void ShowWMIObject(string p, object o)
    {
    if (o != null)
        {
        Console.WriteLine("{0}{1}", p, o);
        }
    }



这篇关于如何找到系统的硬盘大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 23:13