php can't run command about android
I would like to create an android project in PHP. I hv wrote a .bat file for PHP to execute:
cd C:\temp
android create project -n test -t 1 -p ./testing -k com.examples.test -a Main
exit
(I have tested that these commands are workable if I just type them in cmd.exe.)
开发者_运维知识库However, if I use PHP to run the .bat file with following code:
<?php chdir("C:\\");
system("test.bat"); ?>
It will be no response at all. Is PHP not able to execute any command about "android"? or any better solution for creating project in PHP?
Thank you.
*.bat file is not a binary executable. I think it can be executed only by system's shell like *.doc file can be opened only by sofware that supports it.
To execute *.bat file you need to execute it via shell's cmd.exe
system("cmd.exe /c test.bat");
Where is your test.bat
file is placed in the file system? The code you are supplied is trying to run it from a root of disk C:.
精彩评论