I use the code below to pass these three parameters from delphi to the bat file:
CommandLine := Format('cmd.exe /c "d:un.bat %s"', [Email, StartDate, EndDate]);
The run.bat file itself contains:
@echo off
cls
D:
cd \test
"C:\PHP\php.exe" index.php %3
What I am trying to do is to call a bat file from Delphi and pass three parameters. The bat file itself executes a php file to which I need to pass this three parameters and access them via $argv
. Using this code I am not able to do this. Can you help me to point out what am I doing wrong?
If you want to pass around three parameters, they should all appear on both the producing and the consuming side, like this:
CommandLine := Format('cmd.exe /c "d:un.bat %s %s %s"', [Email, StartDate, EndDate]);
(assuming that StartDate and EndDate are strings, adapt accordingly if needed) and in the batchfile
@echo off
cls
D:
cd \test
"C:\PHP\php.exe" index.php %1 %2 %3
Where %1 means "the first command line parameter", %2 "the second", and so on.