C#中得到可执行文件(程序)的路径和文件名
[ 2007-09-17 10:55:17 | 作者: admin ]
//p.s. 记一下,不然又忘记
//得到可执行文件的路径(包括名称)
string hostName = Application.ExecutablePath;
//获取最初指定程序的位置
hostName = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
//获取程序的路径(包括名称)
hostName = System.Reflection.Assembly.GetExecutingAssembly().Location;
//获取程序的路径(不包括程序名称)
string hostName = System.Reflection.Assembly.GetExecutingAssembly().Location;
hostName = hostName.Substring(0 ...
阅读全文…
//得到可执行文件的路径(包括名称)
string hostName = Application.ExecutablePath;
//获取最初指定程序的位置
hostName = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
//获取程序的路径(包括名称)
hostName = System.Reflection.Assembly.GetExecutingAssembly().Location;
//获取程序的路径(不包括程序名称)
string hostName = System.Reflection.Assembly.GetExecutingAssembly().Location;
hostName = hostName.Substring(0 ...
阅读全文…
1