How to open (execute) a .bat file by php?

2

I have a .bat file whose function is to send a .pdf file to the printer. In the same directory I have my .php file. I used the exec('imprimir.bat') function, and tried the same code from the .bat file only using system :

system('cmd /c cd C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader AcroRd32.exe /t "D:\documento.pdf" "HP DeskJet 2130 series" "HP DeskJet 2130 series" "USB002"') .

And I even tried to link JavaScript:

<input type="button" value="imprimir" onclick="window.open('imprimir.bat')" />

But nothing worked! The page is in an eternal loading loop and does not execute the command. Could someone help me?

    
asked by anonymous 08.06.2018 / 23:01

0 answers