Passing string path from installation program to exe application


Ok. Here is the question:
I want to send a path of an old ini file from my installation program to my exe application.
How can I do that?

One way is to write the path to windows register or to text files that my exe application can pick up. But I do not want to this.

Are there other ways? With ShellExecute and parameter passing maybe?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Is this for a one-off at install time? Just call the application and pass as a commad-line parameter, then check for that in the Delphi app via CommandString() or CmdString or whatever it's called (!)
Not a bad idea but be sure you use ExtractShortPathName() to pass that parameter because sometimes Windows thinks that in f.e. "C:\Program Files\Application" is the "C:\Program" first and "Files\Application" second parameter so you will get an error message with "File Does Not Exist".

michaenhAuthor Commented:

>Is this for a one-off at install time?

Yes it is.. I have know just call the application and pass as a commad-line parameter..
How do I call it in Delphi app via CommandString() or CmdString?

Many thanks

Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

Use the installer to call your application, passing the ini file path as a parameter.

Then, inside Delphi, in something like the OnFormShow event of the main form, use ParamCount to see whether there are any command-line parameters, and ParamStr to fetch them. Then you can look for the ini file supplied etc.

(Sorry it's not CommandString() - ParamCount and ParamStr are what you need. That'll teach me for not looking it up. They're in the help)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
michaenhAuthor Commented:
Thanks! :)

Thats why you got me confused...  CommandString()/CmdString??.. smile.. :)

could run run application like that
filename /ini.file

and in your application you can access the file like that
// paramstr(1) = /ini.file
// so we need to remove the "/"
filename := copy(paramstr(1), 2, 255);
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.