开发者

Application path [duplicate]

Th开发者_高级运维is question already has answers here: Closed 11 years ago.

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; 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜