// Obtain the complete path of the current process, including the file name (process name ).
String STR = This. GetType (). Assembly. location;
// Result: X: \ XXX \ xxx.exe (.exefile)
// Obtain the complete path of the new process component and associate it with the active process, including the file name (process name ).
String str1 = system. Diagnostics. process. getcurrentprocess (). mainmodule. filename;
// Result: X: \ XXX \ xxx.exe (.exefile)
// Obtain and set the full path of the current directory (that is, the directory from which the process starts.
String str2 = system. environment. currentdirectory;
// Result: X: \ XXX (directory of the .exe file)
// Obtain the base Directory of the current application domain of the current thread, which is used by the Assembly conflict resolution program to detect the assembly.
String str3 = system. appdomain. currentdomain. basedirectory;
// Result: X: \ XXX \ (directory where the .exe file is located + "\")
// Obtain and set the name of the directory containing the application.
String str4 = system. appdomain. currentdomain. setupinformation. applicationbase;
// Result: X: \ XXX \ (directory where the .exe file is located + "\")
// Obtain the path of the executable file that started the application, excluding the name of the executable file.
// String str5 = system. Windows. Forms. application. startuppath;
// Result: X: \ XXX (directory of the .exe file)
// Obtain the path of the executable file that started the application, including the name of the executable file.
// String str6 = system. Windows. Forms. application. executablepath;
// Result: X: \ XXX \ xxx.exe (.exefile)
// Obtain the current working directory of the application (unreliable ).
String str7 = system. Io. Directory. getcurrentdirectory ();
// Result: X: \ XXX (directory of the .exe file)
String dbname = "AAA ";
String databasefilename = system. environment. currentdirectory + "\" + dbname;