获取我的.exe的路径

我如何获取我的.exe路径,因为如果我复制.exe可以获取我的新路径?



郎朗坤
浏览 258回答 4
4回答

慕的地6264312

System.Reflection.Assembly.GetEntryAssembly().Location;

月关宝盒

此外:AppDomain.CurrentDomain.BaseDirectoryAssembly.GetEntryAssembly().Location

慕桂英546537

在Windows窗体项目中:对于完整路径(包括文件名):string exePath = Application.ExecutablePath;仅对于路径:string appPath = Application.StartupPath;

慕的地10843

在visualstudio 2008中,您可以使用以下代码:   var _assembly = System.Reflection.Assembly               .GetExecutingAssembly().GetName().CodeBase;   var _path = System.IO.Path.GetDirectoryName(_assembly) ;
打开App,查看更多内容
随时随地看视频慕课网APP