Jump to content

Running a windows bat file from PHP


wmeredith

Recommended Posts

$cmd = 'c:\test.bat';
exec($cmd);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$cmd=("c:\test.bat")
function execInBackground($cmd) { 
    if (substr(php_uname(), 0, 7) == "Windows"){ 
        pclose(popen("start /B ". $cmd, "r"));  
    } 
    else { 
        exec($cmd . " > /dev/null &");   
    } 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

exec('C:\Windows\System32\cmd.exe' /c START 'C:\test.bat')

  • 4 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.