使用下面的代码,命令提示符在出现后几乎立即消失。此代码不应该显示所有正在使用的可移动驱动器吗?
using System.Linq;
using System.IO;
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var drives = DriveInfo.GetDrives()
.Where(drive => drive.IsReady && drive.DriveType == DriveType.Removable);
Console.WriteLine("Removable drives being used:", drives);
}
}
}
提前谢谢了!