InnoSetup Pass License Key as Custom Parameter

Posted on August 22, 2020 at 11:44 am

Place this code inside CurStepChanged() within ssPostInstall step:

//allow usage of command-line parameter /LICENSEKEY=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
//and copy the key in a file license.key in installation folder
if ExpandConstant('{param:licensekey|none}') <> 'none' then
begin
    SaveStringToFile(ExpandConstant('{app}')+'\license.key', ExpandConstant('{param:licensekey|none}'), False);
end;

So then you can run the setup.exe like this:

setup.exe /LICENSEKEY=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

A file named license.key containing the submitted key will be saved in the installation folder.

Useful to auto-activate a product via setup.exe command-line.

Receive updates via email

Other Posts

Updated Posts