您的位置:首页 > 理论基础

如何查询计算机中的盘符信息

2011-12-14 20:10 225 查看
        DriveInfo info = new DriveInfo("C:");

        this.Response.Write(info.DriveType.ToString() + "<br/>");

        this.Response.Write(info.DriveFormat.ToString() + "<br/>");

        this.Response.Write(info.TotalFreeSpace + "<br/>");

        this.Response.Write("---------------------------------------------<br>");

        DriveInfo[] infos = DriveInfo.GetDrives();

        foreach (DriveInfo i in infos)

        {

            this.Response.Write("type:" + i.DriveType.ToString());

            this.Response.Write("<br>");

            this.Response.Write("name" + i.Name + "<br>");

            if (i.DriveType!=DriveType.CDRom)

            {

                this.Response.Write("freespace:" + i.TotalFreeSpace.ToString() + "<br>");

            }

            this.Response.Write("========================================<br>");

        }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  c