Sindbag
Sindbag

Reputation: 353

Run .exe with some params

I have to generate .txt file then use it with .exe file on my server.

Firstly, I make for example somefile.txt. Then I use .bat command to open .exe file with params:
"qb.exe -c somefile.txt > somefile.qb"
I need to do it on server automatically after pushing the "Generate" button.
Any ideas how to make it on php?
I know about shell_exec() (found somewhere) and exec(), but how can I use params (-c file.txt>file.qb)?

Thank you very much for your help.

Upvotes: 0

Views: 613

Answers (1)

Herbert
Herbert

Reputation: 5778

As @hakre alludes to in the comment: You can pass parameters as part of the command.

For example:

exec('qb.exe -c file.txt > file.qb');

You may find Program Execution in PHP: exec, system, passthru, and shell_exec, oh my! useful for determining which of PHP’s many program execution functions best fits your needs.

Upvotes: 1

Related Questions