顶,不是很复杂,你可以先判断文件名需要改的字段有多少位,然后使用 DOS命令 改名即可 Process p=new Process();
p.StartInfo.FileName="cmd.exe";
p.StartInfo.UseShellExecute=false;
p.StartInfo.RedirectStandardInput=true;
p.StartInfo.RedirectStandardOutput=true;
p.StartInfo.RedirectStandardError=true;
p.StartInfo.CreateNoWindow=true;
p.Start();
p.StandardInput.WriteLine("ren "+sourceFileName + " " + whitherFileName);
p.StandardInput.WriteLine("Exit");
string strOut=p.StandardOutput.ReadToEnd();
p.Close();
p.StartInfo.FileName="cmd.exe";
p.StartInfo.UseShellExecute=false;
p.StartInfo.RedirectStandardInput=true;
p.StartInfo.RedirectStandardOutput=true;
p.StartInfo.RedirectStandardError=true;
p.StartInfo.CreateNoWindow=true;
p.Start();
p.StandardInput.WriteLine("ren "+sourceFileName + " " + whitherFileName);
p.StandardInput.WriteLine("Exit");
string strOut=p.StandardOutput.ReadToEnd();
p.Close();
还是用FILE类的MOVE方法好啊,又不用调DOS.