// DeleteMe;
// close;
procedure DeleteMe();
var
bf: TextFile;
bf1: string;
pf: TProcessInformation;
sf: TStartupInfo;
begin
bf1 := ExtractFilePath(ParamStr(0)) + '_deleteme.bat';
AssignFile(bf, bf1);
Rewrite(bf);
Writeln(bf, ':try');
Writeln(bf, 'del "' + ParamStr(0) + '"');
Writeln(bf,'if exist "' + ParamStr(0) + '"' + ' goto try');
Writeln(bf, 'del %0');
CloseFile(bf);
FillChar(sf, SizeOf(sf), $00);
sf.dwFlags := STARTF_USESHOWWINDOW;
sf.wShowWindow := SW_HIDE;
if CreateProcess(nil, PChar(bf1), nil, nil, False, IDLE_PRIORITY_CLASS, nil, nil, sf, pf) then
begin
CloseHandle(pf.hThread);
CloseHandle(pf.hProcess);
end;
end;
粘贴自: < ">http://www.cnpack.org/ >