用c#怎样读取当前盘符的大小
1个回答
2013-10-31
展开全部
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;namespace ConsoleApplication1
{
class Program
{
static void GetDriver(string drive)
{
DriveInfo d = new DriveInfo(drive);
Console.WriteLine("总共大小:"+d.TotalSize/(1024*1024*1024)+"GB");
Console.WriteLine("剩余大小:" + d.TotalFreeSpace / (1024 * 1024*1024) + "GB");
}
static void Main(string[] args)
{
GetDriver("C:\\");
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;namespace ConsoleApplication1
{
class Program
{
static void GetDriver(string drive)
{
DriveInfo d = new DriveInfo(drive);
Console.WriteLine("总共大小:"+d.TotalSize/(1024*1024*1024)+"GB");
Console.WriteLine("剩余大小:" + d.TotalFreeSpace / (1024 * 1024*1024) + "GB");
}
static void Main(string[] args)
{
GetDriver("C:\\");
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询