和顺序有关吗?应该不会,楼主可以重新下载我的测试代码:<br>楼主可以到这里重新下载:<br>地址: ftp.mlfjnp.com<br>帐户和密码均为:dfw<br><br><br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> Button2: TButton;<br> Button3: TButton;<br> Button4: TButton;<br> Button5: TButton;<br> procedure Button1Click(Sender: TObject);<br> procedure Button2Click(Sender: TObject);<br> procedure FormCreate(Sender: TObject);<br> procedure Button3Click(Sender: TObject);<br> procedure Button4Click(Sender: TObject);<br> procedure Button5Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> if renamefile('c:/test/a/a','c:/test/a/b') then<br> Application.MessageBox('转换成功','提示')<br> else<br> Application.MessageBox('转换不成功','提示');<br> sleep(100);<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>begin<br> if renamefile('c:/test/a/b','c:/test/a/a') then<br> Application.MessageBox('转换成功','提示')<br> else<br> Application.MessageBox('转换不成功','提示');<br> sleep(100);<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>//这里只是简单写一下,没有进行出错判断<br> RemoveDir('c:/test/a/a');<br> RemoveDir('c:/test/a/b');<br> RemoveDir('c:/test/b/a');<br> RemoveDir('c:/test/b/b');<br> RemoveDir('c:/test/a');<br> RemoveDir('c:/test/b');<br> RemoveDir('c:/test');<br><br> CreateDirectory('c:/test',nil);<br> CreateDirectory('c:/test/a',nil);<br> CreateDirectory('c:/test/a/a',nil);<br>end;<br><br>procedure TForm1.Button3Click(Sender: TObject);<br>begin<br> if renamefile('c:/test/a','c:/test/b') then<br> Application.MessageBox('转换成功','提示')<br> else<br> Application.MessageBox('转换不成功','提示');<br> sleep(100);<br>end;<br><br>procedure TForm1.Button4Click(Sender: TObject);<br>begin<br> if renamefile('c:/test/b','c:/test/a') then<br> Application.MessageBox('转换成功','提示')<br> else<br> Application.MessageBox('转换不成功','提示');<br> sleep(100);<br>end;<br><br>procedure TForm1.Button5Click(Sender: TObject);<br>begin<br> if renamefile('c:/test/a/a','c:/test/a/b') then<br> Application.MessageBox('转换成功','提示')<br> else<br> Application.MessageBox('转换不成功','提示');<br><br> if renamefile('c:/test/a','c:/test/b') then<br> Application.MessageBox('转换成功','提示')<br> else<br> Application.MessageBox('转换不成功','提示');<br><br>end;<br><br>end.