2013-10-31 67 views
2

我想用輸入文件和參數運行.exe應用程序。如何在php exec()中傳遞參數?

用CMD我可以成功啓動這樣的可執行文件...

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

然而,沒有任何反應,當我簡單地複製粘貼上面的字符串到這樣的exec()函數..

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

我需要逃避串的部分?我應該如何繼續?

+0

您能不能告訴你的PHP代碼? – uptownhr

+0

請向我們展示您的整個聲明,包括'exec()'調用。 – TiMESPLiNTER

回答

3

只是傳遞參數就像從外殼正常通話

例如:

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

我想這一點,但沒有任何反應 – Skogen

+2

嘗試'EXEC( 「C:\\ Program Files文件\\ MyApp.exe的\」 路徑\\輸入文件\ 「的說法」)' – TiMESPLiNTER

0

我不得不使用這種格式

php -q "./yii.php" migrate/up --interactive=0 [email protected]/pheme/yii2-settings/migrations