C# 路徑中獲取文件全路徑

C# 路徑中獲取文件全路徑、目錄、擴(kuò)展名、文件名稱



學(xué)習(xí)下載專區(qū) 【2019-11-14 15:50】


//獲取當(dāng)前運行程序的目錄

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:\
————————————————
友情鏈接:
sql修復(fù)專家
  • 關(guān)注微博
    聯(lián)系QQ
  • 二維碼
  • 掃一掃加關(guān)注

——信陽市速全網(wǎng)絡(luò)科技有限公司——

版權(quán)所有:信陽市速全網(wǎng)絡(luò)科技有限公司

豫ICP備19030104號-2