How do I recognize command-line parameters in my Delphi program?
command-line, delphi, parameters
Solution
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
Problem
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?