How to get parameter string ?

Just like main(argv,argc) in C, Delphi also has the similar variables to get parameter string coming from command line.

Following is the simple example to display parameter list by showmessage function.

procedure TMainFrm.Button3Click(Sender: TObject);
var i: Integer;
  for i := 1 to ParamCount do
    ShowMessage( ParamStr(i));

As you can see above, you can know the total number of parameters by ParamCount. In addition, You can get the parameter string by ParamStr function as well.

Leave a Reply

Your email address will not be published. Required fields are marked *