不知道下面这个程序,是不是你想要的??????
using System;
using
namespace _06_12
{
public class Class_06_12
{
public static void Main()
{
string currentDir=Directory.GetCurrentDirectory ();
string parentDir=Directory.GetParent (currentDir).Name ;
string dirRoot=Directory.GetDirectoryRoot (currentDir);
string[] rootDirs=Directory.GetDirectories (dirRoot);
string[] rootFiles=Directory.GetFiles (dirRoot);
string[] drives=Directory.GetLogicalDrives ();
Console.WriteLine ("当前目录是:{0}",currentDir);
Console.WriteLine ("当前目录的父目录是:{0}",parentDir);
Console.WriteLine ("当前目录的根目录是:{0}",dirRoot);
Console.WriteLine ("根目录下的子目录是:");
foreach(string s in rootDirs)
{
Console.WriteLine (s);
}
Console.WriteLine ("所有的逻辑磁盘是:");
foreach(string s in drives)
{
Console.WriteLine (s);
}
}
}
}