开发者

How to find USB driver letter? [closed]

开发者 https://www.devze.com 2023-01-25 07:38 出处:网络
开发者_高级运维It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form.
开发者_高级运维 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

I own one of those old U3 Cruzor USB's, and I want to create an application running on the image/iso/cd part (with a custom flash using "universal customizer") finding the other driver letter, reading an ini (.inf) file and starting an application based on what it finds in that file.

Not sure what language to create it in. But I would like it to be as small, fast and compatible as possible (windows xp, vista, 7. and not requiring .NET framework).

How does I find the driver letters for the USB?


This can be achieved using the DriveInfo class: http://msdn.microsoft.com/en-us/library/abt1306t.aspx

To get the volume label of the drive do the following.

    DriveInfo[] allDrives = DriveInfo.GetDrives();

    foreach (DriveInfo d in allDrives)
    {
        if ((d.IsReady == true) && (d.DriveType == DriveType.Removable))
        {
             Console.WriteLine(d.VolumeLabel);
        }
    }

edit: just saw you dont want to use .NET...

0

精彩评论

暂无评论...
验证码 换一张
取 消