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

C G E Mannerheim

Total Post:28

Points:196
Posted by  C G E Mannerheim
C# 
C#
 2309  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:51

    Points:359
    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
        }
    }

      Modified On Apr-03-2018 05:15:57 AM

Answer

NEWSLETTER

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