获取程序目录

  string s = System.IO.Directory.GetCurrentDirectory();
Console.WriteLine(s);// C:\Users\r-\documents\visual studio 2013\Projects\TestMVC\ConsoleApplication1\bin\Debug
s=s.Substring(,s.LastIndexOf("\\"));
Console.WriteLine(s);//C:\Users\r-\documents\visual studio 2013\Projects\TestMVC\ConsoleApplication1\bin
s=s.Substring(, s.LastIndexOf("\\"));
Console.WriteLine(s);//C:\Users\r-\documents\visual studio 2013\Projects\TestMVC\ConsoleApplication1

其他总结

//获取到bin目录的下层路径:bin\Debug\

            string aa = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;

            string cc = System.AppDomain.CurrentDomain.BaseDirectory;

            //获取到bin目录:bin\Debug

            string dd = System.Environment.CurrentDirectory;

            string ee = System.IO.Directory.GetCurrentDirectory();

            string ff = System.Windows.Forms.Application.StartupPath;

            //获取程序.exe

            string bb = System.Windows.Forms.Application.ExecutablePath;

最新文章

  1. [UE4][Custom Animation Graph Node]Evaluate Pose by Curve
  2. codeforces 340C Tourist Problem
  3. Mybatis Physical Pagination
  4. 将Spark中CompactBuf转换为String
  5. Html - Footer
  6. RM报表里的变量
  7. 日历控件修改的JS代码
  8. bzoj2734 集合选数
  9. button 禁止
  10. 内置函数 -- filter 和 map
  11. JFinal项目发送邮件——jfinal-mail-plugin
  12. 随手一记,maven打包
  13. “/"应用程序中的服务器错误
  14. React高级指引
  15. 【转】flannel网络的VXLAN及host-gw
  16. RoR - Introduction to Active Record
  17. vue教程自学笔记(三)
  18. VIVADO 入门之仿真与逻辑分析仪使用
  19. Inferred type 'S' for type parameter 'S' is not within its bound;
  20. 在VC++中怎样改变控件间的TAB切换顺序?

热门文章

  1. HashMap vs Hashtable
  2. 【转】32位plsql连接64位oracle
  3. poj1753(高斯消元解mod2方程组)
  4. Jmeter-逻辑控制器之Switch控制器(Switch Controller)
  5. BZOJ 2725 [Violet 6]故乡的梦 线段树+最短路树
  6. spring中使用缓存
  7. C++11 特性:成员函数引用限定 (Reference qualifier)
  8. ArcGIS-各类问题
  9. Kibana问题记录:yarn test 运行报错 error Trailing spaces not allowed no-trailing-spaces
  10. PreparedStatement是如何防止SQL注入的?