Thursday, December 29, 2011

Paramstr function


The ParamStr function returns one of the parameters from the command line used to invoke the current program.


Paramstr(0): Returns the application/executable path
Param(1): Return the 1st parameter
ParamStr(2): Return the 2nd parameter ...

Example:

Command line to call the test.exe with two params:- C:\Testsamples\text.exe A B

Program:

for i:=0 to paramcount do
ShowMessage('ParamStr(' + IntToStr(i) + '): ' + ParamStr(i));

Output:
Paramstr(0): C:\Testsamples\text.exe
Param(1): A
ParamStr(2): B