How can I get the absolute path of program I'm running?
+3
A:
For that you can use the Application
object.
Startup path, just the folder, use Application.StartupPath()
Dim appPath As String = Application.StartupPath()
Full .exe path, including the program.exe name on the end:, use Application.ExecutablePath()
Dim exePath As String = Application.ExecutablePath()
Nick Craver
2010-02-07 06:10:59
does not allow me application. Is this in a namespace that I need to import? if so which?
Linda
2010-02-07 06:16:15
It's in System.Windows.Forms
Matthew Flaschen
2010-02-07 06:21:01
I am using a console app
Linda
2010-02-07 06:41:10
+1
A:
For a console application you can use System.Reflection.Assembly.GetExecutingAssembly().Location
as long as the call is made within the code of the console app itself, if you call this from within another dll or plugin this will return the location of that DLL and not the executable.
lee-m
2010-02-07 12:12:35
A:
I use:
Imports System.IO
Dim strPath as String=Directory.GetCurrentDirectory
Corey B
2010-05-25 20:16:22