2012-08-14 29 views
1

我想推出一個bat文件或EXEPHP推出一個Windows應用程序

我試圖

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 
+0

還要注意,如果包含空格(我猜測它的確如此,你的錯誤信息)。例如:'system(「start \」C:\\ Path with spaces \\ program.exe \「」);' – 2012-08-14 14:15:37

+0

我用C:\ PROGRA〜1 \ MICRO〜2 \這樣的短路徑代替長路徑路徑 – 2012-08-14 16:20:22

回答

1

嘗試exec函數:

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

+0

這沒有奏效。無論出於何種原因,我無法啓動應用程序。我決定創建一個簡單的VBS腳本,並使用PHP作爲臨時解決方案重新啓動PC – 2012-08-16 18:47:20

0

這個沒有工作。無論出於何種原因,我無法啓動應用程序。我決定創建一個簡單的VBS腳本,然後使用PHP作爲臨時解決方案重新啓動PC