string path = @"C:\Program Files\IIS\..\Lenovo";
if(Directory.Exists(path))
{
System.Diagnostics.Process.Start("explorer.exe", path);
}
这个方法有些不完善,只能打开绝对路径,不能打开的Path中 具有../../../这样的符号这样的相对路径,在Directory.Exists中是可以判断相对路径的,但是在System.Diagnostics.Process.Start("explorer.exe", path); 打开时,却无法识别相对路径,所以需要改成
string path = @"C:\Program Files\IIS\..\Lenovo";
path = Path.GetFullPath(path);
if(Directory.Exists(path))
{
System.Diagnostics.Process.Start("explorer.exe", path);
}