Prova questo (banale) programmello che ho appena compilato
http://www.franzauker.com/lanciabat.exe
l'uso è semplice
lanciabat nome_del_file.bat
è un po'... rustico, ho dei clienti cui fare teleassistenza.
vediamo se risolve
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.