If you want the standard behavior of the "installation path" of Inno Setup to include command line processing /DIR= , you must bind your own path to the standard one.
So, you should copy the original WizardForm.DirEdit value to your own checkbox:
var Page: TInputDirWizardPage; procedure InitializeWizard(); begin ... Page := CreateInputDirPage(...); Page.Add(...); Page.Values[0] := WizardForm.DirEdit.Text; end;
This solution handles not only /DIR= , but also /LOADINF= .
To complement the above code, you must copy the value back to WizardForm.DirEdit . Thus, make sure that when you reinstall / upgrade, the previously selected value is reused. This is shown in paragraph 1) of my response to Use two / more selected directories from a user page in the Files section .
If the above is too complicated (or not obvious) to implement, due to the complex logic of your installer, you can handle the software /DIR= programmatically yourself. See Setting the value of the Inno Setup custom configuration field from the command line .
procedure InitializeWizard(); var DirSwitchValue: string; begin Install := ...; Install.Add(...); DirSwitchValue := ExpandConstant('{param:DIR}'); if DirSwitchValue <> '' then begin Install.Values[0] := DirSwitchValue; end else begin Install.Values[0] := ExpandConstant('{pf}\Mysoft'); end; end;
This solution obviously does not handle /LOADINF= . How to process .inf files is shown in Inno Setup Download default values ββfor custom installation settings from a file (.inf) for silent installation .
In addition, with this solution, the previously used installation path will not be used for upgrades / reinstallations. How to implement this is shown in Inno Setup with three destination folders .
source share