Calling ExeOutput executable from Batch File on Windows with Parameters

jacquelinemck

New member
Can I call my ExeOutput application from a BAT file and pass in parameters that will be picked up by the initial file. Let’s say my initial file is index.php (home page). My executable is myprogram.exe.

Can I have a bat file:

parameter1=%COMPUTERNAME%
start C:\myprogram.exe parameter1
exit

And then in my http://heserver/index.php pickup the parameters like http://heserver/index.php?arg1=parameter1?

Is there a way to run my application via command line and pass in variables/information?
 
Absolutely 🙂

Have a look at PHP’s getopt function - http://php.net/manual/en/function.getopt.php

To test your example, you would run your batch file as…
Code:
parameter1=%COMPUTERNAME%
start C:\myprogram.exe --arg1 parameter1
exit
And pick that up in PHP using getopt…
Code:
<?php
   $options = getopt("",array("arg1:"));
   var_dump($options);
?>
Returning that to the CLI, you would get something like…
Code:
array(1) {
   ["arg1"]=>
   string(8) "MYLAPTOP"
}
… but obviously you could use that in your code any way you choose 🙂

Kait
 
Have you had success with this before? I’ve done this for regular PHP scripts. But have you actually done this for an ExeOutput application? I am trying this and I am getting a NULL argv.
 
Back
Top