在ConsoleApplication和WindowsFormsApplication都能使用:
//获取应用程序自身路径和文件名
string filePath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
只能在WindowsFormsApplication使用:
//获取应用程序自身路径和文件名
string filePath = System.Windows.Forms.Application.ExecutablePath;