命令行:setup.exe /param1 /param2="param2 value"
[Code]
// 检查是否存在指定参数
function CheckFlag(PName:String):Boolean;
var
CmdLine : String;
CmdLineLen : Integer;
i : Integer;
begin
Result := false;
CmdLineLen:=ParamCount();
for i:=0 to CmdLineLen do
begin
CmdLine:=ParamStr(i);
if CmdLine= PName then
begin
CmdLine:=ParamStr(i+1);
Result := true;
Exit;
end;
end;
end;
var
Info: String;
Flag: Boolean;
begin
Flag := CheckFlag('/param1');
if(Flag = true) then
Info := 'found param1'
else
Info := 'can not found param1'
Msgbox(Info + #13#13 + ExpandConstant('{param:param2|default value}'), mbInformation, MB_OK);
......
end;