1. 获取绝对文件路径
代码如下:
System.IO.Path.GetFullPath(string path)
string fileName = “myfile.ext”;
string path1 = @”mydir”;
string path2 = @”\mydir”;
string fullPath;
fullPath = Path.GetFullPath(path1);
fullPath = Path.GetFullPath(fileName);
fullPath = Path.GetFullPath(path2);
2. 获取文件名字(得到指定路径内的文件名,不包括扩展名)