note 90664 added to function.system
| From: | grytolle at gmail dot com | Date: | Sun, 03 May 2009 17:12:09 +0000 |
| Subject: | note 90664 added to function.system | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-154165@lists.php.net to get a copy of this message | ||
This is a work-around that makes the program run in it's own directory instead of the
script's.
example usage:
runAsynchronously("c:\games\jazz2\jazz2.exe","-connect 1.2.3.4");
function runAsynchronously($path,$arguments) {
$WshShell = new COM("WScript.Shell");
$oShellLink = $WshShell->CreateShortcut("temp.lnk");
$oShellLink->TargetPath = $path;
$oShellLink->Arguments = $arguments;
$oShellLink->WorkingDirectory = dirname($path);
$oShellLink->WindowStyle = 1;
$oShellLink->Save();
$oExec = $WshShell->Run("temp.lnk", 7, false);
unset($WshShell,$oShellLink,$oExec);
unlink("temp.lnk");
}
----
Server IP: 212.63.193.10
Probable Submitter: 217.210.2.92
----
Manual Page -- http://www.php.net/manual/en/function.system.php
Edit -- https://master.php.net/note/edit/90664
Del: integrated -- https://master.php.net/note/delete/90664/integrated
Del: useless -- https://master.php.net/note/delete/90664/useless
Del: bad code -- https://master.php.net/note/delete/90664/bad+code
Del: spam -- https://master.php.net/note/delete/90664/spam
Del: non-english -- https://master.php.net/note/delete/90664/non-english
Del: in docs -- https://master.php.net/note/delete/90664/in+docs
Del: other reasons-- https://master.php.net/note/delete/90664
Reject -- https://master.php.net/note/reject/90664
Search -- https://master.php.net/manage/user-notes.php