using System.IO; namespace DPumpHydr.WinFrmUI.WenSkin.DLL { public class FolderFileClass { public static void OpenFolderAndSelectFile(string fileFullName) { if (File.Exists(fileFullName)) { System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("Explorer.exe") { Arguments = "/e,/select," + fileFullName }; System.Diagnostics.Process.Start(psi); } else { string pPath = System.IO.Path.GetDirectoryName(fileFullName); //获取文件路径 System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("Explorer.exe") { Arguments = "/e,/select," + pPath }; System.Diagnostics.Process.Start(psi); } } } }