Run .bat by a button

-2

How can I run a .bat in the site folder by a button? This can be done in other languages too if not possible only by PHP

<button type="submit" class="btn btn-primary btn-lg">Executar .bat</button>
    
asked by anonymous 03.11.2017 / 02:22

1 answer

1

In PHP, you can use the shell_exec >:

<?php
    $output = shell_exec('seu-arquivo.bat');
    echo "<pre>$output</pre>";
?>

It is important, however, first of all to make sure that this is safe, ensuring that it is not possible for any user to run any script.

    
03.11.2017 / 14:25