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

2023-09-02 11:51:23 作者:那疼、说不出

可能重复:   How做我得到当前的可执行文件在C#中的名字?

这是可执行文件加载外部库。 有没有一种方法让库知道调用可执行文件?

(我发誓我看到了这个问题的答案在其他地方,但我似乎无法找到它了)

解决方案

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

R 软件安装

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