Home > php教程 > php手册 > php调用com 组件wscript.shell执行dos命令

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 11:22:30
Original
1805 people have browsed it

/php调用com 组件wscript.shell执行dos命令
  p('


');<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>   }	<br>
	
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template