【转】C#获取当前路径7种方法
生活随笔
收集整理的這篇文章主要介紹了
【转】C#获取当前路径7种方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
webform
var s = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; //C盤 IIS路徑 var s1 = System.Environment.CurrentDirectory; //同上 var s2 = System.IO.Directory.GetCurrentDirectory();//同上 var s3 = System.AppDomain.CurrentDomain.BaseDirectory; //當前項目根目錄 var s4 = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase; //同上
var s = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; //C盤 IIS路徑 var s1 = System.Environment.CurrentDirectory; //同上 var s2 = System.IO.Directory.GetCurrentDirectory();//同上 var s3 = System.AppDomain.CurrentDomain.BaseDirectory; //當前項目根目錄 var s4 = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase; //同上
winformSystem.Windows.Forms.Application.StartupPath System.Windows.Forms.Application.ExecutablePath
?
轉載于:https://www.cnblogs.com/wdw31210/p/4304987.html
總結
以上是生活随笔為你收集整理的【转】C#获取当前路径7种方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 开源协议
- 下一篇: DBA查询命令积累——不断更新