[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

PHP to open Command Line and write command

Asked by andreyman3d2k in PHP Scripting Language, Miscellaneous Web Development

Tags: PHP, Web Development, Command Line

I need PHP to open the command prompt, type a command into it, and run it.

The prompt is located at: C:/WINDOWS/system32/cmd.exe

The command is:

"C:/Program Files/gs/gs8.61/bin/gswin32c.exe" -sDEVICE=jpeg -dNOPAUSE  -dBATCH -sOutputFile="C:/Documents and Settings/Andrey/My Documents/xampp/htdocs/ProjectArchive/albums/edit/pdftmp".substr($filename, 0, strlen($filename)-4).".jpg\" "C:/Documents and Settings/Andrey/My Documents/xampp/htdocs/ProjectArchive/$image"


I am trying:

$cmd = "C:/WINDOWS/system32/cmd.exe \"C:/Program Files/gs/gs8.61/bin/gswin32c.exe\" -sDEVICE=jpeg -dNOPAUSE  -dBATCH -sOutputFile=\"C:/Documents and Settings/Andrey Grigoryev/My Documents/xampp/htdocs/ProjectArchive/albums/edit/pdftmp/".substr($filename, 0, strlen($filename)-4).".jpg\" \"C:/Documents and Settings/Andrey Grigoryev/My Documents/xampp/htdocs/ProjectArchive/$image\"";
exec ($cmd, $output, $retval);

But it returns an error (and does something completely idiotic in addition)

What would be the proper syntax?

Thank you.
[+][-]10/29/09 11:49 AM, ID: 25696879Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/29/09 12:24 PM, ID: 25697272Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/29/09 02:35 PM, ID: 25698504Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/29/09 07:54 PM, ID: 25699918Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/02/09 07:08 AM, ID: 25720016Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625