System.Environment.CurrentDirectory;
Application.ExecutablePath;(包括名稱)
Application.StartupPath;(不包括名稱)
string
str = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
result: X:\xxx\xxx\xxx.exe (.exe文件所在的目錄+.exe文件名)
string
str = System.Environment.CurrentDirectory;
result: X:\xxx\xxx (.exe文件所在的目錄)
string
str = System.AppDomain.CurrentDomain.BaseDirectory;
result: X:\xxx\xxx\ (.exe文件所在的目錄+"\")
string
str = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
result: X:\xxx\xxx\ (.exe文件所在的目錄+"\")
string
str = System.Windows.Forms.Application.StartupPath;
result: X:\xxx\xxx (.exe文件所在的目錄)
string
str = System.Windows.Forms.Application.ExecutablePath;
result: X:\xxx\xxx\xxx.exe (.exe文件所在的目錄+.exe文件名)
string
str = System.IO.Directory.GetCurrentDirectory();
result: X:\xxx\xxx (.exe文件所在的目錄)