Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I recognize command-line parameters in my Delphi program? [closed]

I plan to run specific application commands every X days using Task Scheduler. Do I have to write support for command-line parameters first, so Scheduler can execute it?

If so, does anyone know any good command-parameter components?

like image 801
Tom Avatar asked Oct 20 '09 09:10

Tom


Video Answer


1 Answers

If you just want to read any cmd line parameters that were passed to your application at start-up you can use Delphi's inbuild functions.

ParamCount   // Number of cmd params passed at startup
ParamStr(0) // string of param zero

So calling you program like so

c:\myapp.exe -foo -bar

would give the following result

ParamStr(0) = c:\myapp.exe
ParamStr(1) = -foo
ParamStr(2) = -bar
like image 68
Re0sless Avatar answered Oct 12 '22 13:10

Re0sless