使用 PHP的 system 功能,你怎么能 向批处理文件传递参数?
system
可能看起来像这样
system("batch.bat argument", $output);
C++可执行文件 here
here
我猜应该比较简单。。。
真正的问题是如何用批处理文件接收参数?
你说得对,没有区别。下面是一个小演示:
首先创建一个批处理文件,以便只输出其参数:
C:\Documents and Settings\SO>type a.bat @echo off echo %*
使用 system 调用批处理文件传递 a b 作为参数:
a
b
C:\Documents and Settings\SO>type a.php <?php system("a.bat a b",$out); ?>
系统 调用bat文件 和 b 批处理文件作为参数运行并回显 一 b
系统
一
C:\Documents and Settings\SO>php a.php a b
http://www.hccp.org/bat-cmd-line-args.html
http://www.rgagnon.com/gp/gp-0009.html