我尝试使用 php 启动安装在 C:\Program Files (x86)\Hewlett-Packard\HP MyRoom\MyRoom.exe 中的外部应用程序。
示例 1: 我正在使用 exec 函数、popen 和系统。 但是 exec 函数在应用程序关闭之前不会执行 exec 命令旁边的代码。
**CODE :**
exec('"C:\Program Files (x86)\Hewlett-Packard\HP MyRoom\MyRoom.exe" ');
示例 2: 当我使用 popen 时,它显示的是 cmd 窗口而不是应用程序。
CODE :
pclose(popen('start "C:\Program Files (x86)\Hewlett-Packard\HP MyRoom\MyRoom.exe" ' ,'r'));
OR
system(' start "C:\\Program Files (x86)\\Hewlett-Packard\\HP MyRoom\\MyRoom.exe" ');
输出: 示例 3:
当我使用此代码时,它是返回字符串输出。
代码:
system(' start /B "C:\\Program Files (x86)\\Hewlett-Packard\\HP MyRoom\\MyRoom.exe" ');
输出:
Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation. All rights reserved. C:\xampp\htdocs\projects\drupal\hpedu\reference>
Any help would be greatly appreciated.
示例 4:
当我尝试这段代码时,它没有返回任何内容。
代码:
exec("start /B \"C:\\Program Files (x86)\\Hewlett-Packard\\HP MyRoom\\notepad++.exe\\MyRoom.exe\" ");
最佳答案
尝试
exec('"C:\Program Files\FileZilla FTP Client\filezilla.exe"');
因为它正在为我服务。
也可以让脚本停止执行,尝试输入“exit;”执行命令后。 如果您想要执行 exec 命令后编写的行,则使用
exec('"C:\Program Files\FileZilla FTP Client\filezilla.exe"|at now');
echo "after quitting the program";
但只有在执行的程序关闭后才会起作用。
关于php - 使用 php 执行外部程序(如 skype.exe),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23870637/