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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:11:25+00:00 2026-05-30T13:11:25+00:00

In my Delphi application, I would like to add command line parameters to automatically

  • 0

In my Delphi application, I would like to add command line parameters to automatically set some parameters in the login screen.

Currently I have a login screen where the user sets some information (like Server, database, user, password, AuthenticationType, AUtoLogin, …).

I use MRU to populate the fields. Anyway, in big organizations, there is the need to do not let the user choose any info. For this, the simplest thing I can do in my scenario is to use command line parameters.

My question is how do you suggest to choose the command line parameters? I mean, should I go for a “position” approach or for some “tag” approach, for example:

MyProject.exe -s:MYSERVER -d:DATABASE

or

MyProject.exe MYSERVER DATABASE

In the first case I need to loop across all parameters using ParamStr and “decode” what they are. If they start with “-s:” I know that what follows is the server name. The second is more quick and dirty but may be more effective.

How to manage parameters that contain a “space”? Is it possible to automatically intercept them with ParamStr or should I handle all manually? (I mean is there a way to automatically tell to ParamStr that a parameter is containing a space (like using curly brackets or something).

What is the best practice?

  • 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-30T13:11:27+00:00Added an answer on May 30, 2026 at 1:11 pm

    Should I go for a “position” approach or for some “tag” approach?

    Without doubt you should tag your command line arguments. Positional approaches don’t allow sufficient flexibility to omit parameters. Tagging makes it easier for the user to understand the arguments, especially when returning to previously written code. The tags should be self-documenting.

    One common scenario when you would have untagged arguments is when you have a file name or a list of file names.

    How to manage parameters that contain a “space”?

    The Windows convention is that spaces are escaped by putting double-quotes around the argument. The ParamStr parsing will recognise these and parse the arguments accordingly. What you see in ParamStr(i) is the argument with the quotes removed.


    The RTL comes with a useful helper function to aid your command-line argument parsing: FindCmdLineSwitch.

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

Sidebar

Related Questions

We have a VCL Delphi 2005 application, and would like to use DevExpress's XtraReports
I have this simple console application in Delphi 2010 and I would like it
I would like to create a Delphi application for Windows XP which allows dropping
I would like to be able to dictate into my Delphi application using Microsoft
I'm using the TServerSocket component in my Delphi application. I would like to limit
For (application) server development with Delphi, I would like to use a workflow engine
I would like to know the better alternatives to the Delphi BDE. We have
I add a toolbar with some standard Delphi components to my application. Unfortunately, the
I would like to know what is the best skinning library for Delphi application
I support an application written in Delphi 3 and I would like to put

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.