Batch file run using PHP works but only displays last line
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
.
精彩评论