March 2000
Intermediate to advanced
576 pages
18h 13m
English
ParamStr Function
function ParamStr(Number: Integer): string;
The ParamStr
function returns the
Numberth command-line parameter.
ParamStr is a real function.
Parameter number zero is the application pathname.
Parameters are numbered from 1 to ParamCount. If
Number is invalid, ParamStr
returns an empty string.
When breaking a command line into parameters, Delphi uses white space characters as separators. Use double quotes around text that contains space characters to include the spaces as part of the parameter (e.g., long filenames).
To look for command-line switches, call the
FindCmdLineSwitch function from the
SysUtils unit.
program Echo;
// Echo command-line arguments, separated by spaces.
{$AppType Console}
var
I: Integer;
begin
if ParamCount > 0 then
Write(ParamStr(1));
for I := 2 to ParamCount do
Write(' ', ParamStr(I));
WriteLn;
end.| CmdLine Variable, ParamCount Function |
Read now
Unlock full access