开发者

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

开发者 https://www.devze.com 2023-02-03 19:46 出处:网络
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?
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

精彩评论

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