如果您想從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