title: Inno Setup - How to copy a file before setup start?
body: <p>I need to copy a file to one folder, before Inno Setup starts or before the "select directory" page. I want this file to be copied from the installer and not from an external source.</p>
  
  <p>I am using this code:</p>
  
  <pre class="lang-pascal prettyprint-override"><code>function NextButtonClick(PageID: Integer): Boolean;
  begin
    Result := True;
    if (PageId = wpWelcome) then
    begin
      FileCopy(
        ExpandConstant('file.exe'),
        ExpandConstant('{reg:HKCU\SOFTWARE\XXX,InstallPath}\file.exe'), false);
    end;
  end;
  </code></pre>