0

i have this cmd command

netaudio subscription add --tx-device-name=DESKTOP-GPC5NH3 --tx-channel-name='Google Chrome:Left' --rx-channel-name='1-Audi~Audio8DJ(ChC,Out5|6~:(R)' --rx-device-name=DESKTOP-GPC5NH3

I testing the code in local environment when I run it in command prompt it's working fine. I have created a .bat file and when I run it manually everything is working . but when I try to run it from php file nothing is executing

i have tested the following commands:

exec('c:\WINDOWS\system32\cmd.exe /c START r.bat' )

page is stuck on waiting to local

echo  pclose(popen("start /C r.bat", "r")); die();
echo system('r.bat');

but nothing seams to work thank you

dror shalit
  • 318
  • 2
  • 12
  • executing command to system with php is insecure – Anas Fanani May 24 '23 at 23:30
  • (Executing command with php is perfectly fine if you need to - just set permissions appropriately on a production server so that the user running apache/php does not have access to anything they shouldn't.) – Robbie May 25 '23 at 00:42
  • Top command: You say, "open a command prompt; inside that command prompt start another command prompt that runs the bat file." but that means the first command prompt never actually closes. You also need to work on what path. But regardless, this question has been asked before. – Robbie May 25 '23 at 00:44
  • 1
    Does this answer your question? [How do you run a .bat file from PHP?](https://stackoverflow.com/questions/835941/how-do-you-run-a-bat-file-from-php) – Robbie May 25 '23 at 00:44

0 Answers0