note 43917 added to function.exec
| From: | msheakoski at tyahood at tcom dot php dot net | Date: | Thu, 08 Jul 2004 12:40:21 +0000 |
| Subject: | note 43917 added to function.exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-72879@lists.php.net to get a copy of this message | ||
I too wrestled with getting a program to run in the background in Windows while the script continues
to execute. This method unlike the other solutions allows you to start any program minimized,
maximized, or with no window at all. llbra@phpbrasil's solution does work but it sometimes
produces an unwanted window on the desktop when you really want the task to run hidden.
start Notepad.exe minimized in the background:
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run("notepad.exe", 7, false);
start a shell command invisible in the background:
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run("cmd /C dir /S %windir%", 0, false);
start MSPaint maximized and wait for you to close it before continuing the script:
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run("mspaint.exe", 3, true);
For more info on the Run() method go to:
http://msdn.microsoft.com/library/en-us/script56/html/wsMthRun.asp
----
Manual Page -- http://www.php.net/manual/en/function.exec.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43917
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43917&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43917&report=yes
Search -- http://master.php.net/manage/user-notes.php