获取应用程序路径信息
//应用程序的可执行文件的路径
string apppath = Application.ExecutablePath;
//指定路径字符串的父目录信息,即当前目录的上一级目录
string str = Path.GetDirectoryName(apppath);
//指定路径字符串的扩展名
string strKZM = Path.GetExtension(apppath);
//不带扩展名的文件名
string strFileName = Path.GetFileNameWithoutExtension(apppath);
//包括文件名和扩展名
string strFile = Path.GetFileName(apppath);
//是否包括了文件扩展名
bool bISExtension = Path.HasExtension(apppath);
//指定路径字符串的绝对路径
string strJDLJ = Path.GetFullPath(apppath);
//指定路径的根目录
string strGML = Path.GetPathRoot(apppath);
//当前系统的的临时文件夹的路径
string strTemp = Path.GetTempPath();
//判断是绝对路径还是相对路径
bool bT = Path.IsPathRooted(apppath);
//路径字符串的分隔符
char c = Path.DirectorySeparatorChar;
//环境变量中分割路径字符串的分隔符
c = Path.PathSeparator;
浙公网安备 33010602011771号