Steps: In the Delphi IDE, choose File/New/Console Application. Then write
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
begin
// Following code you have to write
if ParamCount = 0 then
begin
Writeln(‘No parameters passed.’);
end;
if ParamCount = 1 then
begin
Writeln(‘One Parameter passed!’);
Writeln(ParamStr(1));
end;
if ParamCount = 2 thenbegin
Writeln(‘Two Parameters passed!’);
Writeln(ParamStr(1));
Writeln(ParamStr(2));
end;
if ParamCount > 2 then
Writeln(‘More than Two Parameters passed!’);
end.
Compile.
Run CMD and go to directory where you saved the project
In Command Prompt
c:\TestConsole\Project1 “hello world”
One parameter passed
hello world
c:\TestConsole\Project1 “hello” “world”
Two Parameter passed
hello
world