note 62249 added to ref.exec
| From: | notatanydotcom at osu1 dot php dot net | Date: | Thu, 23 Feb 2006 08:16:59 +0000 |
| Subject: | note 62249 added to ref.exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104270@lists.php.net to get a copy of this message | ||
at LAST! tenacity pays off, days trying every little thing!
I didn't want batch files. I'm trying to use PHP to get rid of batch files.
I didn't want to call a file to parse the parameters to call a shell to call a file. I've
got "systems" right now with batches tiered three and five deep.
I just wanted to run stuff.
CALL, tested on WinXP, will be testing on more OSes right away, in PHP4 and 5, with exec, system,
works with popen, and passthru.
here is my lame sample function.
// CreateZip
function createzip ($target, $archive)
{ $ziputil = "call \"c:\\Program Files\\7-zip\\7z.exe\"";
$archived = escapeshellarg($archive);
$targeted = escapeshellarg($target);
$shellcommand= $ziputil." a -tzip ".$archived."
".$targeted."\n";
// all of the below are working in Win XP Pro
passthru ($shellcommand);
exec ($shellcommand);
system ($shellcommand);
shell_exec ($shellcommand);
$proc= popen ($shellcommand, "r"); //$proc contains output
LONG PATH NAMES WITH SPACES IN THEM ON WINDOWS!
all in a big long concatenated command line with multiple quoted-filename parameters
shell scripting bliss!
----
Server IP: 216.194.113.175
Probable Submitter: 68.230.46.140
----
Manual Page -- http://www.php.net/manual/en/ref.exec.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+62249
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62249&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62249&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62249&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62249&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62249&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62249&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62249&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+62249&report=yes
Search -- http://master.php.net/manage/user-notes.php