Possible Duplicate:
How can I get the application's path in .NET in a console app?
How can I get application path? (folder the executable is in)
Determine the Executing Application's Path
path = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase );
From Brad Abrams site, you might want to look at this code:
Console.WriteLine (Environment.GetCommandLineArgs()[0]);
Or, from comments in that link:
System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
精彩评论