在php中执行批处理文件

时间:2015-04-08 07:49:39

标签: php batch-file

我想打开服务器,然后通过php执行批处理文件 该批处理文件存储在c:\tools\patch.bat中。

我尝试了以下代码,但它无法正常工作。

$output = array();  
exec('$name -w c:\tools\ c:\tools\patch.bat',$output); 

此处$name是服务器的名称,patch.bat是批处理文件。

1 个答案:

答案 0 :(得分:0)

也许你可以创建一个本地bat文件server_batch.bat:

$name -w c:\tools\ c:\tools\patch.bat

然后像这样运行:

$output = array();  
exec('<path_to_batch>\server_batch.bat',$output); 
相关问题