开发者

Application path [duplicate]

开发者 https://www.devze.com 2023-03-01 11:01 出处:网络
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?
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

精彩评论

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