Si desea analizar los argumentos de línea de comandos de código en Inno, a continuación, utilizar un método similar a esto. Sólo tiene que llamar el guión Inno desde la línea de comandos de la siguiente manera:
C:\MyInstallDirectory>MyInnoSetup.exe -myParam parameterValue
A continuación, se puede llamar al GetCommandLineParam gusta este lugar que lo necesite:
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;
Espero que esto ayude ...
Gracias a todos por las respuestas. Todos fueron útiles. Odio elegir solo una como respuesta preferida. – AlanKley