Wenn Sie von Code in inno Befehlszeilenargumente zu analysieren und dann eine Methode ähnlich dazu. Rufen Sie einfach die inno-Skript über die Befehlszeile wie folgt:
C:\MyInstallDirectory>MyInnoSetup.exe -myParam parameterValue
Dann können Sie die GetCommandLineParam wie dies nennen, wo Sie es brauchen:
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 arry 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;
Hope this ...
Dank alle für die Antworten hilft. Alle waren hilfreich. Ich hasse es, nur eine als die bevorzugte Antwort auszuwählen. – AlanKley