procedure CheckResult(b: Boolean); begin if not b then raise Exception.Create(SysErrorMessage(GetLastError)); end; function RunDOS(const Prog, CommandLine, Dir: string; var ExitCode: DWORD): string; var HRead, HWrite: THandle; StartInfo: TStartupInfo…