C# 檔案是否存在,資料夾是否存在

C# 檔案是否存在,資料夾是否存在

C# 檔案是否存在,資料夾是否存在



判斷目錄是否存在
//判斷C槽是否存在
if (Directory.Exists(“C:”))
{
     //有
}

//判斷執行檔路徑裡檔案CMD.txt是否存在
if (System.IO.File.Exists(Application.StartupPath + @”\COM.TXT”))
{
     //有
}

2 thoughts on “C# 檔案是否存在,資料夾是否存在

  1. C# 判斷檔案是否存在/檢查檔案是否存在 (C# 確認 檔案 存在)

    判斷 檔案 是否 存在
    判斷 目錄 是否 存在

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *