现在的位置: 首页 > 综合 > 正文

获取当前程序的执行路径

2013年02月17日 ⁄ 综合 ⁄ 共 194字 ⁄ 字号 评论关闭

代码如下: string path = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);

或者:

string path=Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);

 

抱歉!评论已关闭.