运行应用程序的可执行目录? [英] Executable directory where application is running from?
本文介绍了运行应用程序的可执行目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从以下位置获取运行我的应用程序的路径(而非可执行文件):
I need to get the path (not the executable) where my application is running from:
System.AppDomain.CurrentDomain.BaseDirectory()
当我使用&我的本地计算机上的 /images/image.jpg工作正常,但是当我在另一台计算机上安装该应用程序时,它说找不到文件,并且还有很多额外的路径信息。
When I run the above statement with & "/images/image.jpg" on my local machine it works fine but when I install the application on another machine it says it cannot find the file and there is a lot of extra path information some.
我只需要应用运行的目录。我正在使用Visual Studio 2008在VB.NET中进行编码。
I just need the directory of where the app is running. I am coding in VB.NET with Visual Studio 2008.
谢谢!
推荐答案
Dim strPath As String = System.IO.Path.GetDirectoryName( _
System.Reflection.Assembly.GetExecutingAssembly().CodeBase)
这篇关于运行应用程序的可执行目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文