如何找到USB驱动器盘符? [英] How to find USB drive letter?

查看:351
本文介绍了如何找到USB驱动器盘符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个安装程序将应用程序安装到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

这篇关于如何找到USB驱动器盘符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆