开发者

Batch file run using PHP works but only displays last line

开发者 https://www.devze.com 2023-01-08 16:42 出处:网络
I have a batch file that displays a list of registry keys. 10000 20000 30000 40000 ..etc. Using PHP, I can display the output of the batch file:

I have a batch file that displays a list of registry keys.

10000 20000 30000 40000 ..etc.

Using PHP, I can display the output of the batch file:

echo exec('file.bat');

This only shows me 40000 though, not the other three entries. How can I see every开发者_运维百科thing?


Use shell_exec() instead.


exec() returns the last line from STDOUT. You can pass a second parameter to capture all of the STDOUT.

exec($command, $output = array());

Then all of the output text will be in $output.

0

精彩评论

暂无评论...
验证码 换一张
取 消