C#.net Winform获取文件路径
来源:互联网 发布:macbook专业修图软件 编辑:程序博客网 时间:2024/05/01 22:26
C# 获取路径 string str1 =Process.GetCurrentProcess().MainModule.FileName; string str2=Environment.CurrentDirectory; string str3=Directory.GetCurrentDirectory(); string str4=AppDomain.CurrentDomain.BaseDirectory; string str5=Application.StartupPath; string str6=Application.ExecutablePath; string str7=AppDomain.CurrentDomain.SetupInformation.ApplicationBase; “Application.StartupPath”:获取当前应用程序所在目录的路径,最后不包含“”; “Application.ExecutablePath ”:获取当前应用程序文件的路径,包含文件的名称; “AppDomain.CurrentDomain.BaseDirectory”:获取当前应用程序所在目录的路径,最后包含“”; “System.Threading.Thread.GetDomain().BaseDirectory”:获取当前应用程序所在目录的路径,最后包含“”; “Environment.CurrentDirectory”:获取当前应用程序的路径,最后不包含“”; “System.IO.Directory.GetCurrentDirectory”:获取当前应用程序的路径,最后不包含“”;