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 3315074
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:18:26+00:00 2026-05-17T22:18:26+00:00

I have associated the .file_5 extension with my application and I used the ParamStr(1)

  • 0

I have associated the “.file_5” extension with my application and I used the ParamStr(1) function in Delphi to show a messagebox that contains the path & file name of the file when I double click on it in explorer using the code below.

procedure TForm1.FormCreate(Sender: TObject);
 var
  TheFile : string;
begin
  TheFile := ParamStr(1);  //filename for the file that was loaded
  ShowMessage(TheFile);
end;

This works, but if I move the file to another location then the location it was originally in, then the message that is shown is not correct.

Example: (using test.file_5)

The original location of the file is in the C:\ drive and when I double click it my application starts and displays a Messagebox that says:

C:\test.file_5

This is correct. If I move that same file to a directory that contains spaces like the program file folder for example then the Messagbox that is displayed is not

C:\Program Files\test.file_5

like I would expect but rather

C:\PROGRA~1.FILE_

which is obviously not the information I am after so my question is how can I use the ParamStr() function to take into account directories that have spaces in them or is there a better function that I should use that works with directories that contains spaces in them.

  • 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-05-17T22:18:27+00:00Added an answer on May 17, 2026 at 10:18 pm

    Your association is set up wrong. Instead of having double_clicking the .file_5 doing

    C:\YourPath\YourApp.exe %1
    

    The association should be set up as

    "C:\YourPathYourApp.exe" "%1"
    

    Notice the double quotes around the %1 – this keeps any spaces contained instead of their causing Windows to pass the short path and filename.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an web application that allows certain domain objects to be associated with
Currently I have a UITabBarController with 4 items on it that all have associated
I have an excel file that has a column that contains a number of
I have a table that contains information pointing to files stored on a file
I have a table that contains information pointing to files stored on a file
I have a JavaEE application that needs to access a file in order to
I have a Delphi 2006 app that writes to a file and then regularly
What to look for when I have associated a CSS file with my Default.aspx
I have a program with an associated file type. However, when I double-click a
I have a Master Page which has an associated css file. On one of

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.