¿Cómo funciona la redirección de salida en Inno Setup?

Vi esta pregunta aquí:¿Cómo obtener una salida de un programa ejecutado en Inno Setup?

Pero no puedo hacer que funcione, el código comentado es mi intento de hacer que esto funcione, pero recurrí a un archivo bat porque no pude hacer que mi redirección funcionara.CacheInstanceName yCacheInstanceDir Las variables globales se definen en otra parte:

function CheckCacheExists(): Integer;
var
  args: String;
  buffer: String;
  ResultCode: Integer;
begin
  // args := 'qlist ' + CacheInstanceName + ExpandConstant(' nodisplay > {tmp}\appcheck.txt');
  // MsgBox(args, mbInformation, MB_OK);
  // Exec(CacheInstanceDir + '\bin\ccontrol.exe', 'qlist ' + CacheInstanceName + ExpandConstant(' nodisplay > "{tmp}\appcheck.txt"'), '', SW_SHOW,

  ExtractTemporaryFile('checkup.BAT');
  Exec(ExpandConstant('{tmp}\checkup.BAT'), CacheInstanceDir + ' ' + 
    CacheInstanceName + ' ' + ExpandConstant('{tmp}'), '', SW_SHOW,
    ewWaitUntilTerminated, ResultCode);
  LoadStringFromFile(ExpandConstant('{tmp}\appcheck.txt'),buffer);
  if Pos('^', buffer) = 0 then
  begin
    Result := 0
  end
  else 
  begin
    Result := 1
  end 
end;

¿Qué estoy haciendo mal?

Respuestas a la pregunta(2)

Su respuesta a la pregunta