×
Home About Us Products Services News Free Scripts Contact
news php scripts and software

C# (C Sharp) example - How to the disk size and the free disk space?


C# (C Sharp) - How to the disk size and the free disk space?

using System;
using System.Management;

...

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

Category: C# (C Sharp)

 
<< Go back