free disk space

October 19, 2008 by admin  
Filed under C Sharp

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");
}
}

Related posts:

  1. free disk space, wmi version free disk space, wmi version with C Sharp using System;using...
  2. Disk drive info Set objWMIService = GetObject(”winmgmts:”) Set objLogicalDisk = objWMIService.Get(”Win32_LogicalDisk.DeviceID=’c:’”) Wscript.Echo  “Total...
  3. Get disk info using VBScript and the FSO Get disk info using VBScript and the FSO Set objFso...
  4. bytes to whatever Function SetBytes(Bytes) As String On Error GoTo errorhandler If Bytes...
  5. find the hostname for a known IP address find the hostname for a known IP address with C...

Related posts brought to you by Yet Another Related Posts Plugin.

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!