110,896
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Windows.Form; // 要添加System.Windows.Form引用
using System.Management; // 要添加System.Management引用
//...
public void Test()
{
ManagementObject disk = new ManagementObject("win32_logicaldisk.deviceid=\"c:\"");
disk.Get();
Console.WriteLine("Logical Disk Size = " + disk["Size"] + " bytes");
Console.WriteLine("Logical Disk FreeSpace = " + disk["FreeSpace"] + "bytes");
System.Windows.Form.MessageBox.Show( "hello" );
}