---
title: "Get Drive Letter and Name using C#"  
description: "Get Drive Letter and Name using C#"  
author: "Dag Hammarskjold"  
published: 2013-10-16  
updated: 2013-10-16  
canonical: https://www.mindstick.com/forum/1690/get-drive-letter-and-name-using-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# Get Drive Letter and Name using C#

I am suffering with a [program](https://www.mindstick.com/blog/12337/scaling-up-your-mentorship-program) that is how can I get hard disks/ [usb](https://www.mindstick.com/articles/13074/what-makes-usb-c-cables-better-than-other-usb-cables)'s, but it only returns me the drive letter not the [name](https://yourviews.mindstick.com/view/87450/how-to-generate-a-brand-name-using-linkedin-comprehensive-guide).

```
DriveInfo[] driveInfo = DriveInfo.GetDrives();
Console.WriteLine("Detected Drives: ");
for(int i = 0; i < driveInfo.Count(); i++)
{
     Console.WriteLine("Drive " + i + ": " + driveInfo[i].Name);
}return driveInfo;
```

and this prints:

Drive 0: C:\

Drive 1: E:\

but I want the name such as

```
Drive 0: C:\ Local disk
```

```
Drive 1: E:\ SacnDisk USB
```

How can I perform that [task](https://www.mindstick.com/forum/161761/what-is-the-difference-between-task-and-thread) please help me!

## Replies

### Reply by Anonymous User

Try this

```
 try
        {
            DriveInfo[] driveInfo = DriveInfo.GetDrives();
            foreach (DriveInfo drive in driveInfo)
            {
                Console.WriteLine("Drive:" + drive.Name);
                Console.WriteLine("Drive Type:" + drive.DriveType);
                if (drive.IsReady == true)
                {
                    Console.WriteLine("Vol Label:" + drive.VolumeLabel);
                    Console.WriteLine("File System: " + drive.DriveFormat);
                }
            }
        }
        catch (Exception)
        {
            throw;
        }
```


---

Original Source: https://www.mindstick.com/forum/1690/get-drive-letter-and-name-using-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
