Reply to exec hide dos box

Your name:

Reply:


Posted by Hendri Adriaens on 03/06/07 09:28

Hi,

I succeeded in finding a workaround for the quotation bug in exec that
caused an error in the apache error logs. here it is:
exec('start "zip" /B "'.$winzip_path.'\wzzip" -m -s'.$password.'
"'.$tmp_new_name.'" "'.$tmp_old_name.'"');

But unfortunately, the /B switch doesn't do it's job, I still see the dos
box. Is there a way to suppress it?

I found the script that is posted below, but that doesn't wait for winzip to
finish. Is there any solution that I can run winzip without a dos box and
that php waits for winzip to finish?

Thank you, best regards,
-Hendri.

function windExec($cmd,$mode=''){
// runs a command line and returns
// the output even for Wind XP SP2
// example: $cmd = "fullpath.exe -arg1 -arg2"
// $outputString = windExec($cmd, "FG");
// OR windExec($cmd);
// (no output since it runs in BG by default)
// for output requires that EXEC_TMP_DIR be defined

// Setup the command to run from "run"
$cmdline = "cmd /C $cmd";

// set-up the output and mode
if ($mode=='FG'){
$outputfile = EXEC_TMP_DIR . "\\" . time() . ".txt";
$cmdline .= " > $outputfile";
$m = true;
}
else $m = false;

// Make a new instance of the COM object
$WshShell = new COM("WScript.Shell");

// Make the command window but dont show it.
$oExec = $WshShell->Run($cmdline, 0, $m);

if ($outputfile){
// Read the tmp file.
$retStr = file_get_contents($outputfile);
// Delete the temp_file.
#unlink($outputfile);
}
else $retStr = "";

return $retStr;
}

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация