static void Main(string[] args)
{
//获取磁盘名称
string[] a = Environment.GetLogicalDrives();
//循环输出
foreach (var item in a)
{
Console.WriteLine(item);
//通过磁盘名称获取其子目录
DirectoryInfo di = new DirectoryInfo(item);
DirectoryInfo[] fi = di.GetDirectories();
//循环输出
foreach (var i in fi)
{
Console.WriteLine(i);
}
}
Console.ReadKey();
}