• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 153
  • Last Modified:

Command line switches

I need help creating a program that will accept command line switches. I do not have a clue where to begin

Any one got any pointers?


Steve
0
stephenarnott
Asked:
stephenarnott
  • 2
1 Solution
 
geobulCommented:
Hi,

See ParamCount and ParamStr functions.

Regards, Geo
0
 
TOndrejCommented:
Also see FindCmdLineSwitch in SysUtils
0
 
geobulCommented:
From Delphi help:

procedure TForm1.FormCreate(Sender: TObject);

var
  i: Integer;
  for i := 0 to ParamCount ? 1 do
  begin
    if LowerCase(ParamStr(i)) = 'beep' then
      Beep(10000,1000)
    else if (LowerCase(ParamStr(i)) = 'exit' then
      Application.Terminate;
  end;
end;

Regards, Geo
0
 
stephenarnottAuthor Commented:
Fast Answers always the best
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now