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

  • SEARCH
  • Home
  • 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 8887147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:44:07+00:00 2026-06-14T21:44:07+00:00

How can I make my Delphi 7 program save itself into a new location.

  • 0

How can I make my Delphi 7 program save itself into a new location. For example the program is saved on my flash stick then when I run it I want it to save itself in c:\user \ (user name)

The above is the original question.

This is the code I tried using. The program runs perfectly but when I check the folder it was supposed to save it in it does not appear there.

 procedure TForm5.FormActivate(Sender: TObject);
  var source, dest : string;
 begin
  Source := 'project1.exe';
  Dest := 'C:\Users\Craig\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup';
  CopyFile(PChar(Source), PChar(Dest), False);
 end;

Thanks for your help.

  • 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-14T21:44:08+00:00Added an answer on June 14, 2026 at 9:44 pm

    Read the executable file name from Application.ExeName. And then call CopyFile to perform the copy.

    Source := Application.ExeName;
    Dest := ...;
    CopyFile(PChar(Source), PChar(Dest), False);
    

    Regarding your update:

    1. The destination needs to be a file. You are attempting to copy a file to a path that specifies a folder.
    2. You didn’t check for errors. When you call an API function like CopyFile, you need to check the return value.

    You want something like this:

    Source := 'project1.exe';
    Dest := 'C:\Users\...\Startup\project1.exe';
    if not CopyFile(PChar(Source), PChar(Dest), False) then
      RaiseLastOSError;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can make my program write a .dat file with an array of Node
I can make batch or vbs file on windows and run. this can automate
I can't seem to find the option to make Delphi collapse a {$REGION}...{$ENDREGION}-block by
How can I make my program load an image and make it the background
I still remember in Delphi, developer can just make the UI(textbox, listbox...) directly connect
I'm trying to populate an xml file into a Delphi ListView1, then group all
Good day. I need some help. I want to make program in Delphi, and
In Delphi 7, an image editor program is included, which can read and write
I am trying to make delphi program Server And Client so To Secure my
Can I use Delphi to program to the Java Native Interface ? From reading

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.