且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何找到当前的可执行文件名?

更新时间:2022-10-23 20:48:52

  System.Diagnostics.Process.GetCurrentProcess()。MainModule.FileName
 

Possible Duplicate:
How do I get the name of the current executable in C#?

An executable file loads an external library.
Is there a way for the library to know the calling executable file?

(I would have sworn I saw the answer to this elsewhere, but I can't seem to find it anymore)

System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName