Using PHP's system
function, how can you pass arguments to a batch file?
It would probably look something like this
system("batch.bat argument", $output);
I found out how to do it with a C++ executable here
I'm guessing it should be relatively simple...
What the real question is is how to receive the argument with a batch file?
You are right, there is no difference. Here is a small demo:
First a batch file to just output its arguments:
C:\Documents and Settings\SO>type a.bat
@echo off
echo %*
A php program that uses system
to invoke the batch file passing a
and b
as args:
C:\Documents and Settings\SO>type a.php
<?php
system("a.bat a b",$out);
?>
On running the php, the call to system
invokes the bat file with a
and b
as arguments, the batch file runs and echoes a
and b
C:\Documents and Settings\SO>php a.php
a b
Arguments in batch file are accessible as %1 %2 etc...