That is equivalent with Directory.GetCurrentDirectory, which does not
always equal to Application.StartupPath (the path of the executable
that started the app).
The best way, I guess, to get Appication.StartupPath is:
Process.GetCurrentProcess().MainModule.FileName
Note that this returns the full path to the executable file while
Application.StartupPath does not contain the file name. To get the path
without file name use Path.GetDirectoryName function.
Bill Butler wrote:
"Eranga" <km***@yahoo.com> wrote in message news:%2***************@TK2MSFTNGP09.phx.gbl...
In c# windows applicatiopns the Application.StartupPath can be used to
find the path for the executable file. How can the same be found for a
console application?(we can't use application because it inherits from
the System.Windows.Forms namespace)
Thanks in advance.
how about this:
using System.IO;
DirectoryInfo di = new DirectoryInfo(".");
Console.WriteLine(di.FullName);