2

我正在尝试使用输入文件和参数运行 .exe 应用程序。

使用 cmd 我可以像这样成功启动可执行文件...

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

但是,当我像这样简单地将上面的字符串复制粘贴到 exec() 函数中时,什么也没有发生。

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

我需要转义部分字符串吗?我应该如何进行?

4

2 回答 2

3

只需像从 shell 中正常调用一样传递参数

前任:

exec("C:\Program Files\MyApp.exe \"path to\input file\" argument") 
于 2013-10-31T13:56:08.310 回答
0

我不得不使用这种格式

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

于 2018-01-29T22:28:51.363 回答