looking for removable usb drives.

from https://stackoverflow.com/questions/3331043/get-list-of-connected-usb-devices/24555068



using System.IO;
foreach (DriveInfo drive in DriveInfo.GetDrives())
{
    if (drive.DriveType == DriveType.Removable)
    {
        Console.WriteLine(string.Format("({0}) {1}", drive.Name.Replace("\\",""), drive.VolumeLabel));
    }
}


留言

熱門文章