note 46459 added to function.exec

From: Date: Tue, 12 Oct 2004 13:30:39 +0000
Subject: note 46459 added to function.exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-78405@lists.php.net to get a copy of this message
I had a bit of trouble using exec with Windows when passing a parameter to a PHP script file. I found I needed to create a Windows batch "wrapper" file to get the script file to accept the optional argument. 1) PHP script file exists: c:\www\script.php 2) PHP is installed in: c:\www\php\ 3) BAT file contains: @c:\www\php\cli\php.exe c:\www\script.php %1 and is saved as: c:\www\script.bat 4) Use exec statement from PHP: exec("c:\www\script.bat $arg", $output); If you want to pass more than one argument, carry on with %2, %3, %4, ..., ... in your BAT file. Hope this helps somebody ---- Manual Page -- http://www.php.net/manual/en/function.exec.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46459 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46459&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+46459&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#78405) next »