开发者

Webpage to to run programs

Hi all I'm brand new to PHP so go easy here. :)

I am attempting to make a bare minimum webpage to run various things on my computer.

For example, I have a button and am attempting to run the following:

<?php
exec("taskkill /IM iexplore.exe");
?>

However, nothing happens. I've read a bunch on Google and here, but I can't find anything that explains this problem. I am on Win 7, UAC disabled, running the latest version of WAMP. (Everything I've found so开发者_运维知识库 far addresses IIS)

Could some one point me in the right direction?


I think what you are looking for is shell_exec

You can also use this built in function from the PHP Manual :

Hope this helps

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");  
}


exec() is for CLI mode (locally). Play with your bash.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜