This example shows how to display the free disk space, wmi and C#
using System;
using System.Management;
class DiskSpace
{
public static void Main (string[] argv)
{
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");
}
}
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.


















