//獲取當前運行程序的目錄
string fileDir = Environment.CurrentDirectory;
Console.WriteLine("當前程序目錄:"+fileDir);
//一個文件目錄
string filePath = "C:\\JiYF\\BenXH\\BenXHCMS.xml";
string str = "獲取文件的全路徑:" + Path.GetFullPath(filePath); //-->C:\JiYF\BenXH\BenXHCMS.xml
str = "獲取文件所在的目錄:" + Path.GetDirectoryName(filePath); //-->C:\JiYF\BenXH
str = "獲取文件的名稱含有后綴:" + Path.GetFileName(filePath); //-->BenXHCMS.xml
str = "獲取文件的名稱沒有后綴:" + Path.GetFileNameWithoutExtension(filePath); //-->BenXHCMS
str = "獲取路徑的后綴擴展名稱:" + Path.GetExtension(filePath); //-->.xml
str = "獲取路徑的根目錄:" + Path.GetPathRoot(filePath); //-->C:\
