Categories

Thousands of experts bid on your personal project at ScriptLance.com

free disk space

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.

You must be logged in to post a comment.