Joey Joey - 17 days ago 8
Vb.net Question

How do I get the filename of my launched file without extension / directory?

How do I find the current name of my launched vb.net project without listing the directory or extension?

I've searched for other solutions, but all of them either has the extension at the end, and/or the directory location at the start, I just want the plain file name, no extension, no directory.

Example:

Dim Filename as string = (code that finds the file name)
MsgBox(Filename)


Which would output
Test
as for this example the program was named
Test.exe

Answer

If this is a WinForms app:

Dim fileName = IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath)