With .net2, how do I get the path of where the .EXE is located for a WinForms
app? e.g. for "h:\myapps\testapp\test.exe" , "h:\myapps\testapp\" should
bee returned

Re: Executable's path by Gregg

Gregg
Thu Jul 26 17:03:49 CDT 2007

c#

using System.IO;
using System.Reflection;

...

string pathDir =
Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);

or if you're really looking for the current directory...

string pathDir = System.Environment.CurrentDirectory;