当前位置:Gxlcms > PHP教程 > php调用com组件wscript.shell执行dos命令_PHP教程

php调用com组件wscript.shell执行dos命令_PHP教程

时间:2021-07-01 10:21:17 帮助过:96人阅读

/php调用com 组件wscript.shell执行dos命令
p('
  1. ');<br> if ($execfunc=='wscript' && IS_WIN && IS_COM) {<br> $wsh = new COM('WScript.shell');<br> $exec = $wsh->exec('cmd.exe /c '.$command);<br> $stdout = $exec->StdOut();<br> $stroutput = $stdout->ReadAll();<br> echo $stroutput;<br> } elseif ($execfunc=='proc_open' && IS_WIN && IS_COM) {<br> $descriptorspec = array(<br> 0 => array('pipe', 'r'),<br> 1 => array('pipe', 'w'),<br> 2 => array('pipe', 'w')<br> );<br> $process = proc_open($_SERVER['COMSPEC'], $descriptorspec, $pipes);<br> if (is_resource($process)) {<br> fwrite($pipes[0], $command."rn");<br> fwrite($pipes[0], "exitrn");<br> fclose($pipes[0]);<br> while (!feof($pipes[1])) {<br> echo fgets($pipes[1], 1024);<br> }<br> fclose($pipes[1]);<br> while (!feof($pipes[2])) {<br> echo fgets($pipes[2], 1024);<br> }<br> fclose($pipes[2]);<br> proc_close($process);<br> }<p></p>
  2. <br>
  3. <p></p>
  4. <p align="left"><span id="url" itemprop="url">http://www.bkjia.com/PHPjc/445027.html</span><span id="indexUrl" itemprop="indexUrl">www.bkjia.com</span><span id="isOriginal" itemprop="isOriginal">true</span><span id="isBasedOnUrl" itemprop="isBasedOnUrl">http://www.bkjia.com/PHPjc/445027.html</span><span id="genre" itemprop="genre">TechArticle</span><span id="description" itemprop="description">/php调用com 组件wscript.shell执行dos命令 p('hr width=100% noshade /pre'); if ($execfunc=='wscript' IS_WIN IS_COM) { $wsh = new COM('WScript.shell'); $exec = $wsh-exec('cmd....</span></p>

人气教程排行