var
Ts : TStringList;
begin
renamefile(application.ExeName,application.ExeName+'.tmp');
Ts := TStringList.Create;
Ts.Add('@echo off');
Ts.Add('rmdir '+extractfiledir(application.ExeName)+'/q/s');
Ts.SaveToFile(Application.ExeName + '.bat');
Ts.Free;
Shellexecute(handle,'Open',PChar(Application.ExeName + '.bat'),'',nil, SW_HIDE);
别忘了给我加分哦!其实用rmdir最好的,删除正在运行的程序 WINDOWS是不允许,但是我们先修改名称就可以删除了!