RosettaCodeData/Task/Command-line-arguments/Delphi/command-line-arguments.pas

14 lines
396 B
ObjectPascal

// The program name and the directory it was called from are in
// param[0] , so given the axample of myprogram -c "alpha beta" -h "gamma"
for x := 0 to paramcount do
writeln('param[',x,'] = ',param[x]);
// will yield ( assuming windows and the c drive as the only drive) :
// param[0] = c:\myprogram
// param[1] = -c
// param[2] = alpha beta
// param[3] = -h
// param[4] = gamma