使用PHP执行bat文件在端口上打印

I would like to print a generated text (in ZPL) with a bat file in PHP on port LPT1. when I execute the bat file, its works normally but when I try to execute it with PHP nothing happen

in PHP :

system("cmd /c C:test.bat");

in bat file : copy C:\wamp64\www\labstock\print\eti.txt LPT1 PAUSE

Result with PHP :

C:\wamp64\www\labstock>copy C:\wamp64\www\labstock\print\eti.txt LPT1 0 fichier(s) copi�(s).

Result when I execute myself :

C:\wamp64\www\labstock>copy C:\wamp64\www\labstock\print\eti.txt LPT1 1 fichier(s) copi�(s).

I had to share my printer and put the path in the bat file:

  1. Share the printer and give it a name

2.in the bat file ( test.bat ) :

copy eti.txt "\\PC_NAME\PRINTER_NAME"

in PHP

exec('cmd /c C:[PATH]test.bat');

Or to get output :

system('cmd /c C:[PATH]\test.bat');