[ACCEPTED]-Get the startup path in a vb.net console exe-io
Accepted answer
You could try
System.AppDomain.CurrentDomain.BaseDirectory
which would work for most cases.
0
EDIT: @KiwiBastard's answer is the correct 3 method:
System.AppDomain.CurrentDomain.BaseDirectory
Add a reference to System.Reflection
and use
Assembly.GetExecutingAssembly().Location
EDIT: Depending 2 where you intend getting the startup path, this 1 might be more appropriate:
Assembly.GetEntryAssembly().Location
You can get the startup path without reflection 1 by using:
IO.Path.GetDirectoryName(Diagnostics.Process.GetCurrentProcess().MainModule.FileName)
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.