开发者

How do i find the absolute path of the exe file in vb.net [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

How can I get the application's path in .NET in a console app?

Hi,

I would like to find the absolute path from where my exe file is running.

i.e if i run my application/exe from c:\my-app\myapp.exe then it should return c:\my-app.

My target is to find my database location inside the db folder.开发者_Go百科


System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase gives you the name of the exe, and System.IO.Path.GetDirectoryName(...) then pulls the directory part out.

See http://msdn.microsoft.com/en-us/library/aa457089.aspx#howtoexecutingapppath_topic2

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜