//获取执行程序的路径一,路径最末带“\”
var str = AppDomain.CurrentDomain.BaseDirectory;
//获取执行程序的路径二,路径最末不带“\”
var str1=System.IO.Directory.GetCurrentDirectory();
//获取执行程序的路径三,路径最末不带“\”
var str3 = System.Environment.CurrentDirectory;
//获取执行程序的路径四,路径最末带“\”
var str4 = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
// 获取启动了应用程序的可执行文件的路径,路径最末不带“\”,适用于Winform程序
System.Windows.Forms.Application.StartupPath
// 获取启动了应用程序的可执行文件的路径及文件名,再配合使用System.IO.Path.GetDirectoryName()方法可获取可执行文件的路径,适用于Winform程序
System.Windows.Forms.Application.ExecutablePath
其它:
System.IO.Path.GetFullPath(),获取执行程序的路径及文件名,等同于System.Windows.Forms.Application.ExecutablePath;
System.IO.Path.GetPathRoot(),获取路径的根目录信息,如:C:\、D:\等。