天天看點

WINFORM 中獲得目錄

1 // 擷取程式的基目錄。

   2 System.AppDomain.CurrentDomain.BaseDirectory

   3 

   4 

   5 // 擷取子產品的完整路徑。

   6 System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName

   7 

   8 

   9 // 擷取和設定目前目錄(該程序從中啟動的目錄)的完全限定目錄。

  10 System.Environment.CurrentDirectory

  11 

  12 

  13 // 擷取應用程式的目前工作目錄。

  14 System.IO.Directory.GetCurrentDirectory()

  15 

  16 

  17 // 擷取和設定包括該應用程式的目錄的名稱。

  18 System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase

  19 

  20 

  21 // 擷取啟動了應用程式的可執行檔案的路徑。

  22 System.Windows.Forms.Application.StartupPath

  23 

  24 

  25 // 擷取啟動了應用程式的可執行檔案的路徑及檔案名

  26 System.Windows.Forms.Application.ExecutablePath      

繼續閱讀