HOW DO I DETECT A USB DRIVE LETTER FROM A C# APPLICATION?

C G E Mannerheim

Total Post:29

Points:203
Posted by  C G E Mannerheim
C# 
C#
 1935  View(s)
Ratings:
Rate this:

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

  1. Hugh Jackman

    Post:52

    Points:366
    Re: How do I detect a USB drive letter from a c# application?

    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
        }
    }

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!