Home > DeveloperSection > Forums > How do I detect a USB drive letter from a c# application?
C G E Mannerheim
C G E Mannerheim

Total Post:29

Points:203
Posted on    October-16-2013 7:13 AM

 C# C# 
Ratings:


 1 Reply(s)
 1577  View(s)
Rate this:

How to detect the USB drive letter from c# program which is not residing in the USB?



Hugh Jackman
Hugh Jackman

Total Post:52

Points:366
Posted on    October-16-2013 7:44 AM

Below line of code will get all of the removable drives attached (including USB drives):

foreach (DriveInfo driveInfo in DriveInfo.GetDrives())
{
    if (driveInfo.DriveType == DriveType.Removable)
    {
        // Code here
    }
}

Don't want to miss updates? Please click the below button!

Follow MindStick