如果您想从Inno Setup中的代码解析命令行参数,请使用类似于此的方法。只需调用命令行安装程序如下:
c:\MyInstallDirectory>MyInnoSetup.exe -myParam parameterValue
然后你就可以调用GetCommandLineParam
这样无论你需要它:
myVariable := GetCommandLineParam('-myParam');
{ ================================================================== }
{ Allows for standard command line parsing assuming a key/value organization }
function GetCommandlineParam (inParam: String):String;
var
LoopVar : Integer;
BreakLoop : Boolean;
begin
{ Init the variable to known values }
LoopVar :=0;
Result := '';
BreakLoop := False;
{ Loop through the passed in array to find the parameter }
while ((LoopVar < ParamCount) and
(not BreakLoop)) do
begin
{ Determine if the looked for parameter is the next value }
if ((ParamStr(LoopVar) = inParam) and
((LoopVar+1) < ParamCount)) then
begin
{ Set the return result equal to the next command line parameter }
Result := ParamStr(LoopVar+1);
{ Break the loop }
BreakLoop := True;
end
{ Increment the loop variable }
LoopVar := LoopVar + 1;
end;
end;
希望这有助于..
在我安装的版本中,至少它看起来像预处理器帮助被合并到主帮助文件中,尽管我记得它们在旧版Inno中是分开的,并且在搜索索引时很难分辨哪个是ISPP,而不是 – Davy8 2009-03-05 14:20:16