如何找到USB驱动器盘符?驱动器、USB

2023-09-02 01:30:51 作者:硬撑

我正在写一个安装程序将应用程序安装到USB驱动器。该应用程序是为了仅用于从USB驱动器,所以它会自动选择USB驱动器安装到为用户节省一个额外的步骤。

I'm writing a setup program to install an application to a USB drive. The application is meant to be used only from USB drives, so it would save an extra step for the user by automatically selecting USB drive to install to.

我会研究是否可使用Nullsoft的或MSI的安装,但因为我最熟悉的.NET我最初打算尝试任何自定义.NET安装程序或安装组件的.NET。

I might explore using Nullsoft or MSI for install, but since I'm mostly familiar with .NET I initially plan to try either custom .NET installer or setup component on .NET.

是否有可能确定一个USB闪存驱动器在Windows上使用.NET的驱动器号?怎么样?

Is it possible to determine the drive letter of a USB flash drive on Windows using .NET? How?

推荐答案

您可以使用:

from driveInfo in DriveInfo.GetDrives()
where driveInfo.DriveType == DriveType.Removable && driveInfo.IsReady
select driveInfo.RootDirectory.FullName