note 80721 added to ref.exec
| From: | lukopostcz at osu1 dot php dot net | Date: | Wed, 30 Jan 2008 02:15:14 +0000 |
| Subject: | note 80721 added to ref.exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-135577@lists.php.net to get a copy of this message | ||
to lancelot:
it's simple exec($my_cmd) on windows executes 'cmd /c $my_cmd'
if there are any spaces in $my_cmd you have to put it in doublequotes:
cmd /c "$app $target" will work
further if there are any spaces in $app and $target they also have to be in doublequotes:
cmd /c ""$app" "$target""
therefore enclose your $cmd in two more doublequotes and dont forget to escape slashes \\
$cmd = "\"\"C:\\my path with spaces\\targetapp.exe\"
\"C:\\mypathnospaces\\targetfile.xxx\"\"";
and exec($cmd) will work :)
no chdir anymore...
----
Server IP: 212.24.129.51
Probable Submitter: 212.71.178.194
----
Manual Page -- http://www.php.net/manual/en/ref.exec.php
Edit -- https://master.php.net/note/edit/80721
Del: integrated -- https://master.php.net/note/delete/80721/integrated
Del: useless -- https://master.php.net/note/delete/80721/useless
Del: bad code -- https://master.php.net/note/delete/80721/bad+code
Del: spam -- https://master.php.net/note/delete/80721/spam
Del: non-english -- https://master.php.net/note/delete/80721/non-english
Del: in docs -- https://master.php.net/note/delete/80721/in+docs
Del: other reasons-- https://master.php.net/note/delete/80721
Reject -- https://master.php.net/note/reject/80721
Search -- https://master.php.net/manage/user-notes.php