Page 1 of 1

Using Exec: pass an argument to be used as php var

Posted: Thu Jan 24, 2008 5:36 am
by dickey
Consider the following code:

Code: Select all

 
<?PHP
  $arg ='sometext';
  $WshShell = new COM("WScript.Shell");
  $oExec = $WshShell->Run("externalprogram.bat $arg", 7, false);
 
  // contents of externalprogram.bat
  //@C:\php\php.exe -q process.php?sometext=%1
?>
 
[If it is possible] I am trying to declare a var in PHP $arg (fine), pass it as an argument to an external program using exec (fine), and then pass that argument (represented as %1) as a var to an external PHP script (bombs).

By experimentation I can't get this to work. I would appreciate some advice.

Kind regards, Andrew

Re: Using Exec: pass an argument to be used as php var

Posted: Thu Jan 24, 2008 6:17 am
by VladSun

Re: Using Exec: pass an argument to be used as php var

Posted: Thu Jan 24, 2008 6:40 am
by dickey
Thanks VladSun, your recommended view topic was spot on again. A great time saver - funny that syntax was just about the only variation I hadn't tried.

Kind regards, Andrew