zoukankan      html  css  js  c++  java
  • C# Winform App 获取当前路径

    直接双击执行 D: est1.exe
    System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName D:Test1.exe
    System.Environment.CurrentDirectory D:
    System.IO.Directory.GetCurrentDirectory()  D:
    System.AppDomain.CurrentDomain.BaseDirectory D:
    System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase D:
    System.Windows.Forms.Application.StartupPath D:
    System.Windows.Forms.Application.ExecutablePath D:Test1.exe


    命令行执行,当前路径为C:,执行D: est1.exe
    System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName d:Test1.exe
    System.Environment.CurrentDirectory C:
    System.IO.Directory.GetCurrentDirectory()  C:
    System.AppDomain.CurrentDomain.BaseDirectory d:
    System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase d:
    System.Windows.Forms.Application.StartupPath d:
    System.Windows.Forms.Application.ExecutablePath d:Test1.exe


    直接双击执行 D:TestTest1.exe
    System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName D:TestTest1.exe
    System.Environment.CurrentDirectory D:Test
    System.IO.Directory.GetCurrentDirectory()  D:Test
    System.AppDomain.CurrentDomain.BaseDirectory D:Test
    System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase D:Test
    System.Windows.Forms.Application.StartupPath D:Test
    System.Windows.Forms.Application.ExecutablePath D:TestTest1.exe

    在F:Test建立快捷方式,设置起始位置为F:Test,然后双击执行
    System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName D:TestTest1.exe
    System.Environment.CurrentDirectory F:Test
    System.IO.Directory.GetCurrentDirectory()  F:Test
    System.AppDomain.CurrentDomain.BaseDirectory D:Test
    System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase D:Test
    System.Windows.Forms.Application.StartupPath D:Test
    System.Windows.Forms.Application.ExecutablePath D:TestTest1.exe

    不会装糊涂,又看得太清楚~_~
  • 相关阅读:
    【转】ASP.NET配置文件详解
    asp.net 使用application实现单点登录(一个账号只能在一个地方登录)
    转:gridview获取当前行索引的方法
    awk中调用shell的自定义函数
    不想做操作工就把你的心静下来
    nagios通过脚本对系统进行定制监控
    关于一个sql执行时间而引发的讨论
    网站前端服务器高可用方案
    NFS在Centos 6.3下的安装
    关于perl中中文乱码的解决办法
  • 原文地址:https://www.cnblogs.com/StevenLi/p/4256393.html
Copyright © 2011-2022 走看看