---
title: "How to get all drives in PC with .NET using C#"  
description: "How to get all drives in PC with .NET using C#"  
author: "Dag Hammarskjold"  
published: 2013-10-16  
updated: 2013-10-16  
canonical: https://www.mindstick.com/forum/1691/how-to-get-all-drives-in-pc-with-dot-net-using-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How to get all drives in PC with .NET using C#

How to get all drives in a PC. and types of every drive and [free](https://www.mindstick.com/articles/12963/3-free-things-to-do-in-valletta)-[space](https://www.mindstick.com/articles/12954/do-your-electrical-repair-in-your-own-space) of each if any [usb device](https://answers.mindstick.com/qa/50233/what-to-do-with-the-issues-that-may-pop-up-at-the-time-of-usb-device-installation) and [external hard](https://answers.mindstick.com/qa/102434/how-do-external-hard-drives-contribute-to-data-backup) [disk](https://answers.mindstick.com/qa/96923/what-are-hard-disk-partitions) is there

i.e. [System](https://www.mindstick.com/articles/23411/the-most-effective-method-to-find-the-perfect-small-business-phone-system-for-your-business)-Drive, CD-Drive, DVD-Drive, Removable etc.

## Replies

### Reply by Anonymous User

```
foreach(var drive in DriveInfo.GetDrives())
{
    Console.WriteLine("Drive Type: {0}", drive.DriveType);
    Console.WriteLine("Drive Size: {0}", drive.TotalSize);
    Console.WriteLine("Drive Free Space: {0}", drive.TotalFreeSpace);
}
```


---

Original Source: https://www.mindstick.com/forum/1691/how-to-get-all-drives-in-pc-with-dot-net-using-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
