mcb*_*npc 4 installation inno-setup
我在这里看到了这个问题:如何在Inno Setup中获得Exec'ed程序的输出?
但我不能让它自己工作,注释掉的代码是我尝试使这项工作,但我使用了一个bat文件,因为我无法使我的重定向工作.CacheInstanceName
并且CacheInstanceDir
是在别处定义的全局变量:
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;
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
输出重定向语法是命令提示符的一个功能,而不是核心Windows API.因此,如果要重定向输出,则需要通过调用命令{cmd} /c actual-command-line > output-file
.不要忘记在适当的地方包含引号,因为{tmp}
(和其他常量)可能包含空格.
但是,您应该强烈考虑将该批处理文件中的任何内容重写为实际代码.您可以在批处理文件中执行任何操作,您可以直接在Inno脚本中或从脚本调用的DLL中执行此操作.这使您可以更好地控制错误检查以及要检索的任何数据的格式.
归档时间: |
|
查看次数: |
3375 次 |
最近记录: |