2

I am trying to run a .exe application with input file and argument.

With cmd I can successfully start the executable like this...

C:\Program Files\MyApp.exe "path\to\input file" argument

However, nothing happens when I simply copy paste the string above into the exec() function like this..

exec("C:\Program Files\MyApp.exe "path\to\input file" argument") 

Do I need to escape parts of the string? How should I proceed?

Skogen
  • 721
  • 1
  • 11
  • 30

2 Answers2

3

Just pass the arguments like a normal calling from shell

ex:

exec("C:\Program Files\MyApp.exe \"path to\input file\" argument") 
Carlos
  • 228
  • 3
  • 10
0

I had to use this format

php -q "./yii.php" migrate/up --interactive=0 --migrationPath=@vendor/pheme/yii2-settings/migrations

FantomX1
  • 1,577
  • 2
  • 15
  • 23