常用路径
//获取当前程序路径,包括文件名
string path = System
.Diagnostics.Process.GetCurrentProcess()
.MainModule.FileName
//获取应用程序的当前工作目录。
string str3 = System
.IO.Directory.GetCurrentDirectory()
string str4 = AppDomain
.CurrentDomain.BaseDirectory
string str5 = System
.Windows.Forms.Application.StartupPath
string str6 = System
.Windows.Forms.Application.ExecutablePath
string str7 = AppDomain
.CurrentDomain.SetupInformation.ApplicationBase
System
.Environment.GetEnvironmentVariable(
"windir")
相对路径,转绝对路径
System
.IO.Path.GetFullPath(
"aaa.txt")
转载请注明原文地址: https://ju.6miu.com/read-969393.html