program show; {$apptype console} uses windows; procedure execute(CommandLine: pchar; var ICond: integer); var StartupInfo: TStartupInfo; ProcessInformation: TProcessInformation; Code : DWORD; begin GetStartupInfo(StartupInfo); ICond := -1; if not CreateProcess( nil, CommandLIne, nil, nil, TRUE, NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, ProcessInformation) then exit; WaitForSingleObject(ProcessInformation.hProcess, INFINITE); GetExitCodeProcess(ProcessInformation.hProcess, Code); ICond := Code; end; var i: integer; st: string; begin st := CmdLine; i := Length(ParamStr(0)); System.Delete(st, 1, i); while Length(st) > 0 do if st[1] in ['"', ' ', ^I] then System.Delete(st, 1, 1) else break; if st = '' then exit; execute( pchar(st), i ); write( i ); ExitCode := i; end.