//获取应用程序的当前工作目录。
String path1 = System.IO.Directory.GetCurrentDirectory();
Console.WriteLine(path1.ToString());
//~\ApolloAutoTest\TestResults\123\Out
//获取程序的基目录。
String path2 = System.AppDomain.CurrentDomain.BaseDirectory;
Console.WriteLine(path2.ToString());
//~\ApolloAutoTest\ApolloAutoTest\bin\Debug
//获取和设置包括该应用程序的目录的名称。
String path3 = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
Console.WriteLine(path3.ToString());
//~\ApolloAutoTest\ApolloAutoTest\bin\Debug
//获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称。
String path4 = System.Windows.Forms.Application.StartupPath;
Console.WriteLine(path4.ToString());
//~\QueryMachineUser\QueryMachineUser\bin\Debug
//获取启动了应用程序的可执行文件的路径及文件名
String path5 = System.Windows.Forms.Application.ExecutablePath;
Console.WriteLine(path5.ToString());
//~\QueryMachineUser\QueryMachineUser\bin\Debug\QueryMachineUser.EXE