I need to run a .cmd batch file from within a php script.
The PHP will be accessed via an authenticated session within a browser.
When I run the .cmd file from the desktop of the server, it spits out some output to cmd.exe.
I'd like to route this output back to the php page.
Is this doable?
Yes it is doable. You can use
exec("mycommand.cmd", &$outputArray);
and print the content of the array:
echo implode("\n", $outputArray);
look here for more info
$result = `whatever.cmd`;
print $result; // Prints the result of running "whatever.cmd"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With