title: Run a .exe with input parameters from PHP web page
body: <p>I'm currently trying to get an executable to run from within a PHP web page (currently using <code>exec()</code>). The program takes two arguments when run from the command line; I'm not sure what the best method would be to run it with PHP. </p>
  
  <p>In particular, the .exe can be run from the command line using the syntax:</p>
  
  <p><code>my_program.exe input_file_name.txt / output_file_name.txt</code></p>
  
  <p>The program processes the data in the input file and puts the processed into into the output file. This all works fine from the command line (in Windows). The .exe is written in Visual Basic (it wasn't written by me). </p>
  
  <p>I know I can normally give <code>exec()</code> a parameter by doing something like:</p>
  
  <p><code>exec('my_program.exe  "example input parameter"');</code></p>
  
  <p>if the .exe is written to take input from <code>argv()</code>, which I've done for testing. I tried a few things like: </p>
  
  <pre><code>$argument = "C:\wamp\www\web_dev\test\input.txt / C:\wamp\www\web_dev\test\output.txt";
  exec('C:\wamp\www\web_dev\test\my_program.exe $argument');
  </code></pre>
  
  <p>Which didn't work out. (I'm currently trying to get it working on my localhost, in case that's pertinent..)</p>
  
  <p>I believe, since the .exe does all the work of opening, writing to, and closing the input and output files, that I just need to figure out how to code a PHP command that will execute the program in the appropriate fashion. </p>
  
  <p>I've seen similar threads to this one, so I hope I'm not re-asking anything; I wasn't able to find a thread that quite pertained to this situation. </p>
  
  <p><strong>Edit:</strong> if it helps, the overall scope I'm working towards is to create a web interface that allows a user to upload a file, then invokes the executable I've been given (which was given to me with the command-line instructions mentioned above) on it and produces an output file for the user with the processed data.</p>