---
title: "How do you detect the main hard drive letter such as C: drive using C#?"  
description: "How do you detect the main hard drive letter such as C: drive using C#?"  
author: "Anonymous User"  
published: 2013-10-16  
updated: 2013-10-16  
canonical: https://www.mindstick.com/forum/1689/how-do-you-detect-the-main-hard-drive-letter-such-as-c-drive-using-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How do you detect the main hard drive letter such as C: drive using C#?

How do you [detect](https://www.mindstick.com/forum/1906/detect-when-cd-drive-was-closed) the main hard drive letter such as C: drive?

## Replies

### Reply by Aaron Douglas

Try this: -

```
Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System));
```


---

Original Source: https://www.mindstick.com/forum/1689/how-do-you-detect-the-main-hard-drive-letter-such-as-c-drive-using-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
