最佳答案
看看这个伪代码:
string exe_path = system.get_exe_path()
print "This executable is located in " + exe_path
如果我构建上面的程序并将可执行文件放在 C:/meow/
中,那么无论当前工作目录如何,每次运行时它都会打印出 This executable is located in C:/meow/
。
如何使用 C#
轻松实现这一点?