Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8907425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:54:44+00:00 2026-06-15T02:54:44+00:00

I need to copy a file to one folder, before Inno Setup starts or

  • 0

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.

I am using this 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;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:54:47+00:00Added an answer on June 15, 2026 at 2:54 am

    To extract a file from the setup archive any time you need you’ll have to use ExtractTemporaryFile procedure. This procedure extracts the file from the [Files] section to a temporary directory used by the setup application, which you can find on the path specified by the {tmp} constant. Then you’ll just copy such extracted file to a target directory from there by expanding the mentioned constant.

    If you want to do something when the setup is being initialized, but before the wizard form is created, use the InitializeSetup event function. Note, that you can even exit the setup from that function without seeing the wizard form e.g. if the file you’re going to copy is critical that much. Here’s a sample code, but first take a look at the commented version of it for some details:

    [Code]
    function InitializeSetup: Boolean;
    begin
      Result := True;
      ExtractTemporaryFile('File.exe');
      if FileCopy(ExpandConstant('{tmp}\File.exe'), 
        ExpandConstant('{reg:HKCU\SOFTWARE\XXX,InstallPath}\File.exe'), False) 
      then
        MsgBox('File copying succeeded!', mbInformation, MB_OK)
      else
        MsgBox('File copying failed!', mbError, MB_OK)  
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to copy a jar file from one directory to another when my
I want to copy some file from one folder to another folder of my
I want to copy a txt file from one folder to another. While coping
In build events I need to copy the whole folder except one specific file.
I need to move files for one folder to another To do this in
I need to move or copy a simple text file from one web site
I need to copy a directory form one source form multiple destination . For
Using VB 6 In my Project, when I copy the file from one folder
I copy image files from one folder to another with help of File.Copy() method.
I made a program in which I want to copy a file from one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.