Originariamente inviato da Aggelos
la vostra soluzione è in effetti ottima, ma esiste un comando per fare questo?




perdonami franz... ma come funziona una cosa simile?
??? intendi come funziona il programmello che ho scritto per un altro utente con la stessa richiesta ???
ho postato il sorgente in un altro thread (è quick-and-dirty ma il suo sporco lavoro lo fa)

codice:
program lanciabat;
{$APPTYPE CONSOLE}
uses     shellapi,forms,sysutils,WinTypes;
function WaitExecute(i_filedaeseguire:string;i_parametri:string;i_flagEsecuzione:cardinal):integer;

var
   SEInfo: TShellExecuteInfo;
   ExitCode: DWORD;
   ParamString, StartInString: string;
begin
   result:=-1;

   if i_filedaeseguire='' then exit;
   if not fileexists(i_filedaeseguire) then exit;
   FillChar(SEInfo, SizeOf(SEInfo), 0);
   SEInfo.cbSize := SizeOf(TShellExecuteInfo);
   with SEInfo do
   begin
     fMask := SEE_MASK_NOCLOSEPROCESS;
     Wnd := Application.Handle;
     lpFile := PChar(i_filedaeseguire) ;
     lpParameters :=pchar(i_parametri);
     nShow := i_flagEsecuzione // SW_HIDE;
   end;
   if ShellExecuteEx(@SEInfo) then
     repeat
       Application.ProcessMessages;
       GetExitCodeProcess(SEInfo.hProcess, ExitCode) ;
     until (ExitCode <> STILL_ACTIVE) or Application.Terminated;
   result:=ExitCode;
end;

begin
   if paramcount=1 then
       WaitExecute(paramstr(1),'',SW_HIDE);
end.
PS come vedi non ho messo il passaggio di parametri nel bat, generalmente è inutile in questi casi, ma se è indispensabile ci vuol poco a cambiare la chiamata