Thre are multiple solutions to execute PHP code upon a button click. I think this SO thread covers them all:
Execute PHP function with onClick - Stack Overflow[
^]
To execute a batch file use the
PHP: exec - Manual[
^] function. It will start
cmd.exe which must be specified when using other functions like
system()
:
exec($path_to_batch_file);
system("cmd /c $path_to_batch_file");
Note that PHP code is executed on the server and you can therefore only execute batch files on the server. There is no method to initiate executing batch files on a client by a web page.