//获取当前运行程序的目录
Application.StartupPath;
Environment.CurrentDirectory;
//一个文件目录
string filePath = "C:\\JiYF\\BenXH\\BenXHCMS.xml";
System.IO.Path.GetFullPath(filePath); //-->C:\JiYF\BenXH\BenXHCMS.xml
System.IO.Path.GetDirectoryName(filePath); //-->C:\JiYF\BenXH
System.IO.Path.GetFileName(filePath); //-->BenXHCMS.xml
System.IO.Path.GetFileNameWithoutExtension(filePath); //-->BenXHCMS
System.IO.Path.GetExtension(filePath); //-->.xml
System.IO.Path.GetPathRoot(filePath); //-->C:\
————————————————