In addition to usual install tasks I need to get the value of the command line parameter (for example /MyParam=XXX
) and then copy the parameter value (XXX
) to a txt file in the app folder. So far I tried the code below but I don't know how to properly pass the parameter value to the code procedure.
[Files]
Source: "MyApp.exe"; DestDir: "{app}"; Flags: ignoreversion overwritereadonly; \
AfterInstall: SaveParam('{param:MyParam}');
[Code]
procedure SaveParam(S: String);
begin
if S<>'' then
begin
SaveStringToFile('{app}\file.txt', 'Value=' + S, False);
end;
end;
In short, when I run the installer by MyApp.exe /MyParam=XXX
I expect the Value=XXX
text would be added into the file.txt
file. Any help is highly appreciated, thanks!