• C# 获取当前路径7种方法及输出


    //获取模块的完整路径。
    string path1 = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
    D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release\XmlAndXsd.vshost.exe

    //获取和设置当前目录(该进程从中启动的目录)的完全限定目录
    string path2 = System.Environment.CurrentDirectory;
    D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release

    //获取应用程序的当前工作目录
    string path3 = System.IO.Directory.GetCurrentDirectory();
    D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release

    //获取程序的基目录
    string path4 = System.AppDomain.CurrentDomain.BaseDirectory;
    D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release\

    //获取和设置包括该应用程序的目录的名称
    string path5 = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
    D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release\

    //获取启动了应用程序的可执行文件的路径
    string path6 = System.Windows.Forms.Application.StartupPath;
    D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release

    //获取启动了应用程序的可执行文件的路径及文件名
    string path7 = System.Windows.Forms.Application.ExecutablePath;
    D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release\XmlAndXsd.EXE

  • 相关阅读:
    vuejs 组件通讯
    导出pdf
    css 鼠标选中内容背景色
    console.log() 字体颜色
    使用cross-env解决跨平台设置NODE_ENV的问题
    Visual Studio动态生成版权信息(VS2015,VS2010,VS2008)
    程序员常用工具汇总
    存储过程分页
    oracle全表扫描
    CDM常用命令
  • 原文地址:https://www.cnblogs.com/flysun027/p/15968053.html
Copyright © 2020-2023  润新知