我正在使用一個小型實用程序,我想更改連接到計算機的閃存驅動器上的卷標。我知道DriveInfo能夠做到這一點,但我對如何完成它感到茫然。如果任何人有代碼示例,我會非常感激。 這裏是我目前有: DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives)
{
if (d.IsReady
準備錯誤我有方法,其檢索其是NTFS的可移動設備的信息: private void getdriverinfo()
{
// get the usb flash driver
foreach (DriveInfo driveInfo in DriveInfo.GetDrives())
{
if (driveInfo.DriveType =
我正在創建一個WPF應用程序,其中應檢查是否存在多個映射的驅動器。代碼很簡單: DriveInfo[] systemDrives = DriveInfo.GetDrives();
foreach (DriveInfo i in systemDrives)
{
if ((i.Name.Contains("V")) && (i.IsReady))
{
result
我有這樣的代碼: DriveInfo dr = new DriveInfo(@"E:\");
if (dr.IsReady == false)
{
MessageBox.Show("Drive E: is not ready. Please insert a blank DVD medium.");
}
所以我在驅動器中插入一張空白DVD和運行代碼。我錯過了什麼? 由於在空白
當前我可以使用DriveInfo.GetDrives()在c#中獲取所有驅動器及其標籤。然後我可以通過這種方法獲得分區的磁盤索引/索引。 var searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_DiskPartition");
foreach (var queryObj in searche