Saturday 10 March 2012

Get Drive Names In system


// Program to get all drives name of your system
using System;
using System.IO;

class Program
{
static void Main()
    {
DriveInfo[] driveArray = DriveInfo.GetDrives();

        foreach (DriveInfo d in driveArray)
                Console.WriteLine("Drive: {0}, Type: {1}, Free Space: {2}, Format: {3}, IsReady:{4}, Root Directory: {5},"+
            "Total Free sapce: {6}, Total Space: {7}, Volume Label: {8}", d.Name,d.DriveType,d.AvailableFreeSpace,d.DriveFormat,d.IsReady,d.RootDirectory,d.TotalFreeSpace,d.TotalSize,d.VolumeLabel);

        Console.ReadLine();
    }
}

No comments:

Post a Comment