PHP 启动一个 Windows 应用程序


PHP launching a Windows application

我想启动一个蝙蝠文件或exe

我试过了

system("C:''PATH''TO''FOLDER''script.bat")
system("CMD.EXE C:''PATH''TO''FOLDER''script.bat")
system("C:''PATH''TO''FOLDER''exefile.exe /S nameOfFileToCreate.txt")
system("CMD.EXE C:''PATH''TO''FOLDER''exefile.exe /S nameOfFileToCreate.txt")
system("START C:''PATH''TO''FOLDER''script.bat")
system("START C:''PATH''TO''FOLDER''exefile.exe /S nameOfFileToCreate.txt")

使用"开始",我收到此错误消息。其他尝试会导致页面永久加载!

Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> WshShell.Exec<br/><b>Description:</b> The system cannot find the file specified. ' in C:'xampp'htdocs'upload.php:95 Stack trace: #0 C:'xampp'htdocs'upload.php(95): com->Exec('START C:'PROGRA...') #1 {main} thrown in C:'xampp'htdocs'upload.php on line 95

试试 exec 函数:

http://us2.php.net/function.exec

不起作用。无论出于何种原因,我都无法启动该应用程序。我决定创建一个简单的VBS脚本,并使用PHP作为临时解决方案重新启动PC