多么期待那2012的到来,迎接那光子带的世界……

C#获取程序运行目录

第一种方法:
 string AppPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
 if (AppPath.EndsWith("\\") || AppPath.EndsWith("/"))
     AppPath= AppPath.Substring(0, AppPath.Length - 1);

第二种方法:
string AppPath = Environment.CurrentDirectory; // 结尾不带"/"


第三种方法:
string AppPath = Directory.GetCurrentDirectory();//获取应用程序的当前工作目录

Directory.SetCurrentDirectory(localFolder);

« c# 不规则窗口实现C#获取项目程序及运行路径的方法 »
  • 相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

Categories

Comments

Previous

Copyright 光子时代 Rights Reserved.

Powered By Z-Blog 1.8 Walle Build 91204

RSS feeds