//获取当前运行程序的目录 string fileDir = Environment.CurrentDirectory; Console.WriteLine("当前程序目录:"+fileDir); //一个文件目录 string filePath = "C:\\JiYF\\BenXH ...
string filePath C: .txt string str 获取文件的全路径: Path.GetFullPath filePath gt C: .txt str 获取文件所在的目录: Path.GetDirectoryName filePath gt C: Console.WriteLine str str 获取文件的名称含有后缀: Path.GetFileName filePath ...
2019-05-25 13:53 0 6338 推荐指数:
//获取当前运行程序的目录 string fileDir = Environment.CurrentDirectory; Console.WriteLine("当前程序目录:"+fileDir); //一个文件目录 string filePath = "C:\\JiYF\\BenXH ...
C# 获取文件名、无后缀文件名、扩展名string filePath = "E:\\test.txt";string LUJING = "获取全路径:" + Path.GetFullPath(filePath); //E:\\test.txtLUJING = "文件所在目录 ...
C# 根据绝对路径获取 带后缀文件名、后缀名、文件名、不带文件名的文件路径 1、c#根据绝对路径获取 带后缀文件名、后缀名、文件名。 2、c#根据绝对路径获取 带后缀文件名、后缀名、文件名,使用 Split 函数。 名称 ...
1、c#根据绝对路径获取 带后缀文件名、后缀名、文件名。 2、c#根据绝对路径获取 带后缀文件名、后缀名、文件名,使用 Split 函数。 ...
string fullPath = @"d:\test\default.avi"; string filename = Path.GetFileName(fullPath);//返回带扩展名的文件名 "default.avi"string extension ...
strRecordFile="d:\RecordFile\2017\03\09\00020170309113442.wav"; 完整文件名: string strFilePaht=strRecordFile.Substring(strRecordFile.LastIndexOf ...
C# 获取文件名及扩展名 string aFirstName = aFile.Substring(aFile.LastIndexOf("\\") + 1, (aFile.LastIndexOf(".") - aFile.LastIndexOf("\\") - 1)); //文件名string ...