I saw this question here: How to get the output of an Exec'ed program in Inno Setup?
But I can not get it to work myself, the code with comments is my attempt to do this work, but I resorted to the bat file because I could not perform the redirection. CacheInstanceName and CacheInstanceDir are global variables defined elsewhere:
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;
What am I doing wrong?
source share