zoukankan      html  css  js  c++  java
  • 【转】c#获取当前应用程序所在路径

    System.Environment.CurrentDirectory       获取和设置当前目录(该进程从中启动的目录)的完全限定目录。

    System.IO.Directory.GetCurrentDirectory()   获取应用程序的当前工作目录。

    System.Windows.Forms.Application.StartupPath    获取启动了应用程序的可执行文件的路径

    ------------------------------------------------------

    System.AppDomain.CurrentDomain.BaseDirectory    获取程序的基目录。

    System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase     获取和设置包括该应用程序的目录的名称。  

    AppDomain.CurrentDomain.BaseDirectory    获取当前应用程序所在目录的路径,最后包含“\”

    System.Threading.Thread.GetDomain().BaseDirectory    获取当前应用程序所在目录的路径,最后包含“\”

    ------------------------------------------------------

    System.Windows.Forms.Application.ExecutablePath     获取启动了应用程序的可执行文件的路径及文件名 

    System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName    获取模块的完整路径,包括文件名。

    ------------------------------------------------------

    在卸载程序获取系统安装的目录

    System.Reflection.Assembly curPath = System.Reflection.Assembly.GetExecutingAssembly();

    string path=curPath.Location;

    //得到安装程序类SetupLibrary文件的路径,获取这个文件路径所在的目录即得到安装程序的目录

    ------------------------------------------------------

  • 相关阅读:
    HDU 1711
    HDU 4135
    HDU 4462
    HDU 1969
    flask的nocache防止js不刷新
    python2.x里unicode错误问题
    使用SwingWork反而阻塞SwingUI
    利用JProfile 7分析内存OOM
    编译android的一些坑
    java jmenu的替代方案
  • 原文地址:https://www.cnblogs.com/lzh_527/p/2285426.html
Copyright © 2011-2022 走看看