Is this possible?
What I want to do is send:
run_app.exe -param 'test' -name 'tester'
to a windows cmd line from PHP.
Is this possible or do I need to write a windows service that is somehow triggered by the application?
Is this possible?
What I want to do is send:
run_app.exe -param 'test' -name 'tester'
to a windows cmd line from PHP.
Is this possible or do I need to write a windows service that is somehow triggered by the application?
Here is a project that allows PHP to obtain and interact dynamically with a real cmd terminal. Get it here: https://github.com/merlinthemagic/MTS
After downloading you would simply use the following code:
The return will give you the command return OR error from cmd, just as if you sat at the console. Furthermore, you can issue any command you like against the $shellObj, the environment is maintained throughout the life of the PHP script. So instead of bundling commands in a script file, just issue them one by one using the exeCmd() method, that way you can also handle the return and any exceptions.
You can use exec() for that.
Or you can use:
Here you can find the run method params: http://msdn.microsoft.com/en-us/library/d5fk67ky%28v=vs.85%29.aspx
And here is the COM class doc: http://www.php.net/manual/en/class.com.php
With this method you can do so much more in windows :). I used it becaus of the [bWaitOnReturn] parameter which I couldn't do using any other method.
Have you tried
exec
?I suggest using standard PHP
system
command. There is plenty of info and examples in official PHP site.There is an answered question on SO for differences between
exec()
,system()
andpassthru()
.